gitnexus-plan
Use when you need a deep, implementation-ready engineering plan for a code change — built from GitNexus graph intelligence, statement-level PDG analysis, and targeted source verification, compact enough that an implementation agent can start without re-investigating. Also strengthens existing plans via Deepen mode. Examples: "/gitnexus-plan Add retry support to the ingestion pipeline", "/gitnexus-plan deepen docs/plans/<plan>.md", "plan this change using the knowledge graph".
How do I install this agent skill?
npx skills add https://github.com/abhigyanpatwari/gitnexus --skill gitnexus-planIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill is a specialized engineering planning tool that uses a custom Node.js helper to ensure plan integrity and perform atomic file operations. It relies on legitimate system utilities and well-known package managers for its core functionality.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
gitnexus-plan — implementation-ready engineering plans
Produce an implementation-ready plan for an engineering task. GitNexus is the
navigation layer (where to look), statement-level PDG is the constraint layer
(what gates and feeds the behavior), and your native targeted source reads are
the verification layer (what is actually true right now). The output is a plan
document plus a compact, machine-readable implementation context pack
that a follow-up implementation agent (gitnexus-work, or any executor) can
consume without repeating the investigation.
/gitnexus-plan <task description>
/gitnexus-plan impact_depth:3 depth:deep <task description> # knob overrides, see Configuration
This skill plans. It never implements. Do not modify production code,
tests, or configuration while running it. The only repository file it writes
is the plan document (a working ledger kept outside the repo is fine). The
only other permitted state change is an index refresh via
analyze --index-only, which writes only the .gitnexus index store. It
must not build analyzer dist/ output and must not mutate source, tests,
configuration, or evaluation data. Stale analyzer provenance is disclosed as
a source-weighted limitation, never repaired by a planning run.
Hard rules
- Ledger first. Before every GitNexus call and every repo file read, check
the context ledger. Never repeat a query or reread an unchanged range that
already answered the same question (allowed repeats are defined in
references/context-ledger.md; this skill's own reference files are exempt from ledger bookkeeping). - Every graph query answers a named planning question. Record the question and the conclusion in the ledger. No exploratory dredging.
- Source beats graph. The graph navigates; current source is authoritative. Verify before asserting (see Phase 4). Comments are the weakest evidence — never stronger than executable code.
- No fabrication. Never invent symbols, filenames, test names, tool results, or PDG edges. Unknowns go to Assumptions and Open Questions.
- No scope creep. Adjacent refactors the task didn't ask for go to plan §12 as explicitly-deferred follow-ups, not into Proposed Changes.
- Pin working-tree evidence, not only HEAD. Every plan form carries the
versioned global dirty digest and sorted cited-path manifest defined in
references/context-ledger.md. Generate it only with the portable helper and byte contract inscripts/evidence-provenance.mjsandreferences/evidence-provenance.md; never reimplement the digest. - Write the plan only through the helper. The generated-plan path is a
normalized repo-relative
docs/plans/YYYY-MM-DD-gitnexus-plan-<3-5-word-slug>.mdpath. Compose the complete UTF-8 document in memory or in a scratchpad outside the target repo, then pass it on stdin to the helper'swrite-plancommand. Never write the destination directly or fall back to an external output path when the safe writer fails. - Read an existing plan only through the helper. Deepen must invoke
scripts/evidence-provenance.mjs read-plan, parse the exact decodedplan_bytes_base64from its descriptor-anchored receipt, and retain that receipt's canonicalgenerated_plan_pathandplan_digestas one binding. Never parse a direct lexical-path read or apply one plan's digest to another path. - Stop when you have enough. Sufficient evidence ends exploration; plans do not improve monotonically with tokens spent.
Phase 0 — Parse and classify
Read references/context-ledger.md and open the ledger with the task:
original request, interpreted goal, acceptance criteria. Classify the task:
| Category | Posture (depth · plan form · tool-call budget · freshness) |
|---|---|
| Bug fix (local) | Narrow, 1–2 primary symbols, impact_depth 1 · compact · ~15 · accept |
| Feature | Default knobs · compact · ~30 · accept |
| Refactor / shared API change | Impact mandatory, impact_depth 3 · full · ~45 · strict |
| Performance | Default + performance PDG mode (references/pdg-slice.md) · full · ~45 · strict |
| Security | Default + security PDG mode + explain taint findings · full · ~45 · strict |
| Dependency upgrade / migration | Impact + compatibility focus; PDG rarely needed · compact · ~20 · accept |
| Concurrency / transactional | Control-flow + state-mutation PDG focus · full · ~45 · strict |
| Test improvement / docs | Narrowest: usually no impact or PDG pass · compact · ~10 · accept |
| Architecture change / spike | Widest: clusters + processes first · full · no cap · strict |
The category posture overrides the Configuration baseline; explicit key:value
invocation knobs override both. A task matching several rows combines them:
take the widest depth, union the focus areas.
Seeded evidence. When a completed investigation already supplies
verified findings — a finished review, a triage document with path:line
anchors and named failing scenarios — open the ledger FROM it: cite the
source document as the opening ledger entries and plan directly against
them instead of re-running the graph ladder over ground it already covers.
Re-deriving what the evidence proves is budget spent against the
turn-economy rule. Phase 4 still source-verifies whatever Proposed Changes
will cite, at the pinned commit — seeding replaces exploration, never
verification.
Depth is the user's decision, asked once, up front. In an interactive
session, when the invocation carries no explicit depth signal (no depth:,
form:, or freshness: knob, and not Deepen mode), ask one blocking
question before Phase 1 — how deep should this plan go?
- Quick —
depth:narrow form:compact freshness:accept. Fastest useful plan: 1–2 primary symbols, minimal graph work, core sections only. - Standard — the category posture above, unchanged. Recommend this unless the classification argues otherwise.
- Deep —
depth:deep form:full freshness:strict. All 13 sections,impact_depth3, clusters/processes read, PDG slices for the central functions.
The answer sets the knobs exactly as if they had been typed in the invocation; explicit knobs win and skip the question. Headless runs never ask — the category posture applies unchanged. Asking up front replaces offering to deepen a finished plan afterwards: Deepen mode (below) remains the mechanism for strengthening an existing plan document — a later session, review findings, an executor route-back — not a default follow-up question.
Turn economy is a deliverable. The plan is judged on decision quality per
token, not thoroughness theater (measured: a 63-turn plan for a two-line
change — the GitNexus repo's eval/workflow_bench/). Stay within the category's tool-call
budget; when the budget runs out with questions still open, record them in
§12 instead of digging further — the executor re-verifies cheaply anyway.
Phase 1 — Anchor and freshness
- Resolve the target repo:
list_reposif in doubt, else the indexed repo covering the working directory. Passrepoexplicitly on every call when more than one repo is indexed. - Record the repo's current HEAD commit in the ledger — every line-number citation in the plan is pinned to it.
- Resolve and record the analyzer runner (used by every
analyzecommand in this skill):node .gitnexus/run.cjs analyze …when the project has a runner (a previous analyze dropped it next to the index), elsegitnexus analyze …(installed CLI —npm install -g gitnexus), elsenpx gitnexus analyze …. Record its path/version and any available source/build identity; do not manufacture provenance from timestamps. - Read
gitnexus://repo/{name}/context— codebase overview + staleness check. Freshness gate. Plans built on a stale graph make stale blast-radius claims — but a re-index is the largest fixed cost a planning session carries, so the gate is category-priced:- Compact-plan categories default to
freshness: accept: plan on the current graph with source verification weighted higher — their plans cite little graph evidence. Escalate to a refresh mid-plan only when a graph claim becomes load-bearing (e.g. Proposed Changes rest on a d=1 dependent list), and only then. - Full-plan categories default to
freshness: strict, and under it: - Analyzer provenance check — before any refresh. Compare the resolved
runner identity with the index metadata and, in an analyzer-source
checkout, with current analyzer source. If identity is stale or unknown,
do not build output and do not make that graph load-bearing. Record a
stale analyzer provenance — source-weighted limitation in
index_refresh, the plan header, and §12; rely on targeted source reads or hand execution togitnexus-work, which owns the build-current gate. - Stale index → run
analyze --index-onlyvia the resolved runner (append--pdgwhen the task category will reach Phase 3) and re-read the context resource only when runner provenance is known-current. Refresh budget, stated once here: at most one--index-onlyrefresh in Phase 1 plus at most one later--pdgupgrade in Phase 3 (only when Phase 1's refresh lacked--pdg) per planning session — a Deepen run is its own session. Record each command, runner identity, and outcome in the ledger'sindex_refresh. - Refresh failed or impractical (no write access to the index, prohibitive
repo size), or
freshness: acceptwas passed → proceed on the stale graph, weight source verification higher, and state the staleness and the skipped refresh in the plan header and Assumptions. - Resources unreadable but tools working → proceed on tools alone, treat freshness as unknown (weight source higher), and note it in the plan.
- GitNexus unavailable entirely → switch to Fallback mode (below).
- Compact-plan categories default to
- For architecture-scale tasks only, also read
gitnexus://repo/{name}/clustersand.../processes.
Phase 2 — Graph navigation ladder
Use the narrowest operation that answers the current ledger question, in this
order. Budgets: at most max_primary_symbols (5) primary symbols and
max_related_symbols (20) related symbols active in the ledger.
query {search_query, task_context}— locate concepts, execution flows, modules, and related tests for the task.context {name}— 360° view of each candidate primary symbol: callers, callees, categorized refs, processes. Promote to primary or discard. Anambiguousresult (ranked candidates) is answered by one retry narrowed withkind/file_path/ uid — that retry is an allowed repeat.impact {target, direction}— upstream/downstream blast radius for shared or high-connectivity symbols (maxDepth=impact_depth;summaryOnly: truefirst for hub symbols, then drill in — an allowed repeat). Record the d=1 items — the direct (depth-1) dependents — the plan must account for every one of them.trace {from, to}— when the task hinges on how A reaches B, one call instead of chained context hops.- Statement-level PDG — Phase 3, for the functions the change centers on.
cypher— last resort, only for a precise graph question the tools above cannot express. Readgitnexus://repo/{name}/schemafirst; anchor and LIMIT every query.detect_changes {scope}— only when planning against existing uncommitted or branch work.
Do not run every tool by default. A local test fix may finish the ladder at step 2.
Phase 3 — Statement-level PDG slice
For the 1–3 functions most central to the change, build a bounded PDG
context slice. Read references/pdg-slice.md and follow it — it owns the
tool calls, inclusion criteria, depth bounds, slice schema, the security and
performance modes, and the no-PDG-layer fallback.
Phase 4 — Targeted source verification
GitNexus said where to look; now confirm what is there. Using ordinary file reads (exact line ranges, not whole files unless genuinely required):
- Read every source range the plan will cite: signatures, branch conditions, state mutations, error paths, nearby comments that change behavior. Compact plans cite less — verify what they cite, don't expand the citation set to have more to verify.
- Read the tests GitNexus associated with the primary symbols; never claim a test exists without having located it.
- Verify the build/test commands the plan will name actually exist (package.json scripts / CI workflows), and prefer the script form that carries its prerequisites (pre-hooks) over invoking underlying binaries directly.
- Check repo conventions that constrain the change (AGENTS.md, GUARDRAILS.md, lint/build config) — only the parts the change touches.
- Mark each ledger symbol
source_verified: trueas you go. A symbol that is named in Proposed Changes must be source-verified. - On graph/source disagreement: trust source, record the discrepancy in the ledger and the plan, recommend re-indexing. Never present stale graph data as fact.
- Immediately before composition, recompute the versioned
evidence_provenancesnapshot by invokingscripts/evidence-provenance.mjsexactly as specified inreferences/evidence-provenance.md: the canonical global dirty digest over all dirty paths and the sorted manifest of every cited path, including object kind and HEAD/index/worktree/untracked layer digests. Re-read any citation that changed during planning. Exclude only the generated plan path.
Evidence hierarchy, strongest first: current source and config → current tests and executable behavior → compiler/build/lint output → GitNexus graph and PDG → documentation and comments.
Phase 5 — Compose the plan
- Read
references/plan-template.mdand fill the category's form — compact (core sections, ≤80 lines excluding the pack) or full (all 13 sections) — from the ledger, tagging claims with the template's four classes —[verified],[graph],[inferred],[assumed]— and routing open questions to §12. - Build the implementation context pack per
references/context-pack.md(this is section 11 of the plan), including mandatoryevidence_provenancein compact and full forms. - Set
generated_plan_pathtodocs/plans/YYYY-MM-DD-gitnexus-plan-<slug>.mdunder the root of the repo being planned (the Phase 1 target repo, not necessarily the cwd); use a 3–5-word kebab-case slug and repo-relative paths inside the document. Compose the complete document without creating that destination, then pipe its exact UTF-8 bytes toscripts/evidence-provenance.mjs write-planas specified inreferences/evidence-provenance.md. The helper safely creates missing parent directories. Initial planning must not pass--replace. A safe-write failure blocks plan publication: report it and do not write directly, choose an external destination, or weaken the repo-relative provenance contract. The snapshot and writer commands apply the same strict generated-plan filename/date validator; do not substitute a source,.git, or arbitrarydocs/plans/path in either invocation. - Present in chat: objective, proposed-changes summary, implementation sequence, top risks, open questions, and the plan file path. Do not paste the whole document into chat.
Deepen mode
/gitnexus-plan deepen <plan-path> strengthens an existing plan in place
instead of creating a new one:
- Resolve the target repository and normalized repo-relative plan candidate,
then load it with
scripts/evidence-provenance.mjs read-plan --repo <root> --generated-plan <candidate>exactly as specified inreferences/evidence-provenance.md. Reject a missing, external, escaping, symlinked, or differently scoped path. Decode and parse only the receipt's exactplan_bytes_base64; retain its canonicalgenerated_plan_pathandplan_digestunchanged for the entire Deepen session. - Re-run Phase 1 in full — analyzer provenance check and freshness gate (a Deepen run is its own session, with its own refresh budget).
- Re-anchor before re-pinning. Recompute the plan's global dirty digest and cited-path manifest as well as comparing its old HEAD pin with current HEAD. Changed, renamed, deleted, mixed, or newly absent cited paths get their ranges re-read — or the claim downgraded — before the pin and provenance snapshot move. Moving only the commit pin silently launders dirty or stale claims as verified.
- Escalate to
depth: deep(impact_depth 3, clusters/processes read) unless the invocation overrides knobs explicitly. - Seed the ledger from the plan's §11 pack, then re-verify: every
[graph]/[inferred]claim gets a targeted pass toward[verified]; every[assumed]claim is resolved or kept with its reason; direct (d=1) dependent accounting is re-checked against the refreshed graph; PDG slices are built or expanded for the central functions when the layer is present. - Reconcile execution state. If
gitnexus-workalready landed commits for this plan (a mid-execution route-back), mark the §7 steps present at HEAD as completed and re-sequence the remainder — the rewritten plan must be executable from the top without redoing landed steps. - Strengthen whatever the deeper pass showed thin — test scenarios, risks, Definition of Done — and carry claim-tag upgrades through the prose.
- Rewrite the same canonical file through
scripts/evidence-provenance.mjs write-plan --replace --expected-plan-path <retained-read-plan-path> --expected-plan-digest <retained-read-plan-digest>: same 13 sections, context pack kept in sync, evidence header updated.--replaceis reserved for Deepen mode, and both expected values must come from the same read-plan receipt; any digest/path mismatch blocks publication. Retain the successful receipt'sprior_plan_backup_git_path; it names the verified Git-admin backup of the displaced plan. Summarize the delta in chat: claims upgraded, claims that failed re-verification, sections changed, and that backup path.
Configuration
Baseline defaults — the Phase 0 category posture overrides them, and inline
key:value tokens before the task text override both (the repo has no
skill-config file mechanism; invocation args are the mechanism):
| Knob | Default | Meaning |
|---|---|---|
depth | by category | narrow = impact_depth 1, PDG only if one function is clearly central; default = this table; deep = impact_depth 3 + clusters/processes read |
form | by category | compact (core sections + mini-pack, ≤80 lines excl. pack — see references/plan-template.md) or full (all 13 sections) |
impact_depth | 2 | maxDepth for impact |
pdg_data_depth | 2 | Data-dependence hops in the PDG slice |
pdg_control_depth | 2 | Control-dependence hops in the PDG slice |
max_primary_symbols | 5 | Ledger budget (active symbols; discards don't count) |
max_related_symbols | 20 | Ledger budget (active symbols; discards don't count) |
max_snippet_lines | 30 | Longest source excerpt quoted in the plan |
freshness | by category | strict (full-plan categories) = refresh a stale index (and a missing PDG layer) with analyze --index-only [--pdg] before relying on the graph; accept (compact categories) = plan on the current graph, source-weighted and labelled, refreshing only if a graph claim becomes load-bearing |
Fallback mode (GitNexus or PDG unavailable)
- Say so, first thing, in chat and in the plan.
- Use targeted repo exploration (grep/glob/reads) to approximate callers, dependencies, execution flow, state changes, and related tests.
- Label every such finding source-derived in the plan — never present it as graph-derived, and never fabricate statement-level edges.
- Recommend
analyze --index-only(add--pdgfor the PDG layers) via the resolved runner —node .gitnexus/run.cjs, installedgitnexus, ornpx gitnexus— when it would materially raise confidence.
Skill feedback
If this run exposed friction in the instructions, include concise feedback in the final response. Feedback is chat-only: do not append evaluation learnings, edit benchmark data, or modify this skill during a live planning task.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/abhigyanpatwari/gitnexus/gitnexus-plan">View gitnexus-plan on skillZs</a>