@alexandrealvaro/agentic 0.9.3-beta.1 → 0.10.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,6 +39,7 @@ Two categories ([ADR-0007](doc/adr/0007-workflow-operational-skills.md)) and two
39
39
  | `agentic-philosophy` | workflow-operational | universal | Universal agent guardrails — auto-loads on non-trivial work | implicit |
40
40
  | `agentic-review` | workflow-operational | universal | Fresh-context code review per WORKFLOW §10; structured findings, no "approve" | `/agentic-review <range>` |
41
41
  | `agentic-ground` | workflow-operational | universal | Four-source pre-implementation research (docs / OSS / in-repo / git history) + happy-path synthesis + deviation gate per WORKFLOW §4 + §5 | `/agentic-ground` |
42
+ | `agentic-next` | workflow-operational | universal | State-aware navigation aid (`flutter doctor` pattern) — surveys the four-layer artifact stack and recommends prioritized next actions; complements `agentic-audit` (drift) | `/agentic-next` |
42
43
  | `agentic-design` | spec-driven | auto if frontend detected | Bootstrap `DESIGN.md` from existing tokens (Figma, tailwind.config, tokens.json, CSS custom props) | `/agentic-design` |
43
44
  | `agentic-subagent` | spec-driven | auto if installing for Claude Code | Drafts `.claude/agents/<name>.md` (Claude Code only — Codex has no subagent primitive) | `/agentic-subagent` |
44
45
  | `agentic-skill` | spec-driven | opt-in only | Drafts a new Claude Code or Codex skill at the appropriate path | `/agentic-skill` |
@@ -152,6 +153,8 @@ The kit ships nine universal skills plus three conditional ones — twelve discr
152
153
 
153
154
  The kit's discipline scales with the project's maturity. A solo PoC may legitimately skip `/agentic-spec` and `/agentic-adr` (the WORKFLOW §1 prune principle applies — don't add an artifact that wouldn't change agent behavior). A team product running on this kit is expected to use the full sequence and additionally invoke `/agentic-hooks` once to scaffold the deterministic gates per WORKFLOW §11 (pre-commit lint / format / secret-scan; pre-push build / unit / integration). Project maturity profiles that automate the recommendation by stack are deferred — see the next planned release.
154
155
 
156
+ **Lost mid-flow?** Invoke `/agentic-next` at any time to survey the project's state across the four-layer artifact stack (Constitution → Spec → Plan/Decisions → Code) and get prioritized next-action recommendations. Read-only; complements `/agentic-audit` (drift detection — different question).
157
+
155
158
  ## Manual prompts
156
159
 
157
160
  If you prefer to skip the installer, the same artifacts can be generated by pasting prompts directly into your agent. Each prompt file has the literal text to copy, plus the matching template structure:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandrealvaro/agentic",
3
- "version": "0.9.3-beta.1",
3
+ "version": "0.10.0-beta.1",
4
4
  "description": "Bootstrap and audit AGENTS.md, ARCHITECTURE.md, ADRs, skills, and subagents for engineering production code with LLMs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,6 +48,7 @@ const ROOT_DOC_LABEL = {
48
48
  updated: '~ ',
49
49
  unchanged: '· ',
50
50
  skipped: '! ',
51
+ 'kept-stale': '! ',
51
52
  absent: '',
52
53
  };
53
54
 
@@ -339,6 +340,7 @@ export async function initCommand(opts) {
339
340
  '/agentic-audit',
340
341
  '/agentic-review (WORKFLOW §10)',
341
342
  '/agentic-ground (WORKFLOW §4 + §5)',
343
+ '/agentic-next (state survey + recommendations)',
342
344
  ...(optedSkills.includes('agentic-design') ? ['/agentic-design (DESIGN.md)'] : []),
343
345
  ...(optedSkills.includes('agentic-subagent') && agents.includes('claude-code')
344
346
  ? ['/agentic-subagent']
@@ -47,6 +47,7 @@ const ACTION_SYMBOL = {
47
47
  kept: '·',
48
48
  skipped: '!',
49
49
  removed: '-',
50
+ 'removed-missing': '?',
50
51
  'orphan-kept': '?',
51
52
  };
52
53
 
@@ -55,6 +56,7 @@ const ROOT_DOC_LABEL = {
55
56
  updated: '~ ',
56
57
  unchanged: '· ',
57
58
  skipped: '! ',
59
+ 'kept-stale': '! ',
58
60
  absent: '',
59
61
  };
60
62
 
@@ -86,13 +88,24 @@ function skillsForAgent(agent, profileName, optedSkills) {
86
88
  return [...universal, ...conditional];
87
89
  }
88
90
 
89
- function previousAgentsFromStates(cwd) {
90
- const out = [];
91
+ /**
92
+ * Load every per-agent state file once. Returns `{ statesByAgent, agents }`
93
+ * where `agents` lists the agents whose state files exist on disk. Avoids
94
+ * the prior pattern of calling `loadState` twice per agent (once for
95
+ * presence detection, once for content); also surfaces malformed-state
96
+ * errors with the loader's own context, in a single pass.
97
+ */
98
+ function loadStatesOnce(cwd) {
99
+ const statesByAgent = {};
100
+ const agents = [];
91
101
  for (const agent of VALID_AGENTS) {
92
102
  const state = loadState(cwd, agent);
93
- if (state) out.push(agent);
103
+ if (state) {
104
+ statesByAgent[agent] = state;
105
+ agents.push(agent);
106
+ }
94
107
  }
95
- return out;
108
+ return { statesByAgent, agents };
96
109
  }
97
110
 
98
111
  function previouslyOptedConditional(previousStates, currentAgents, profileName) {
@@ -140,18 +153,23 @@ export async function updateCommand(opts) {
140
153
  }
141
154
 
142
155
  const cwd = process.cwd();
143
- const interactive = process.stdout.isTTY && !opts.yes && !opts.agent;
156
+ // `--agent` is purely a narrowing flag and does not imply non-interactive
157
+ // intent. Only `--yes` or a non-TTY shell suppress the TUI per ADR-0009.
158
+ const interactive = process.stdout.isTTY && !opts.yes;
144
159
  const dryRun = Boolean(opts.dryRun);
145
160
  const force = Boolean(opts.force);
146
161
 
147
162
  const detectedAgents = detectAgents(cwd);
148
163
  const features = detectFeatures(cwd);
149
- const previousAgents = previousAgentsFromStates(cwd);
164
+ const { statesByAgent, agents: previousAgents } = loadStatesOnce(cwd);
150
165
 
151
166
  const agents = resolveAgents(opts.agent, detectedAgents, previousAgents);
167
+ // previousStates is the per-agent slice of statesByAgent restricted to the
168
+ // agents the current invocation targets. Agents outside the slice keep
169
+ // their state file untouched on disk.
152
170
  const previousStates = {};
153
171
  for (const agent of agents) {
154
- previousStates[agent] = loadState(cwd, agent);
172
+ previousStates[agent] = statesByAgent[agent] ?? null;
155
173
  }
156
174
 
157
175
  const profileName = profileFromStates(previousStates, agents);
@@ -282,13 +300,24 @@ export async function updateCommand(opts) {
282
300
  }
283
301
  : async () => true;
284
302
 
285
- const rootDocAction = !dryRun
286
- ? await updateRootDoc({
287
- cwd,
288
- skills: skillDisplayOrder,
289
- confirmAppend,
290
- })
291
- : { type: 'absent', path: null };
303
+ const confirmRootDocReplace = interactive
304
+ ? async (path) => {
305
+ const answer = await p.confirm({
306
+ message: `${path}: managed section diverged on disk. Regenerate it? (any edits between the agentic-managed-skills markers will be lost)`,
307
+ initialValue: false,
308
+ });
309
+ if (p.isCancel(answer)) return false;
310
+ return answer;
311
+ }
312
+ : async () => Boolean(force);
313
+
314
+ const rootDocAction = await updateRootDoc({
315
+ cwd,
316
+ skills: skillDisplayOrder,
317
+ confirmAppend,
318
+ confirmReplace: confirmRootDocReplace,
319
+ dryRun,
320
+ });
292
321
 
293
322
  const lines = allActions.map((a) => {
294
323
  const sym = ACTION_SYMBOL[a.type] ?? '?';
@@ -356,7 +356,16 @@ export async function removeOrphanSkills({
356
356
 
357
357
  for (const f of entry.files) {
358
358
  const abs = join(cwd, f.path);
359
- if (existsSync(abs) && !dryRun) {
359
+ if (!existsSync(abs)) {
360
+ // State recorded the file at install time but it is gone on disk
361
+ // now (manually deleted, moved, or never written). Surface as a
362
+ // distinct action so the user sees the state-vs-reality mismatch
363
+ // instead of a silent "removed" line for a file that was never
364
+ // there.
365
+ actions.push({ type: 'removed-missing', path: f.path, agent });
366
+ continue;
367
+ }
368
+ if (!dryRun) {
360
369
  unlinkSync(abs);
361
370
  }
362
371
  actions.push({ type: 'removed', path: f.path, agent });
@@ -20,7 +20,7 @@ export const PROFILE_NAMES = ['poc', 'solo', 'team', 'mature'];
20
20
 
21
21
  export const PROFILES = {
22
22
  poc: {
23
- universal: ['agentic-philosophy', 'agentic-ground', 'agentic-audit'],
23
+ universal: ['agentic-philosophy', 'agentic-ground', 'agentic-audit', 'agentic-next'],
24
24
  conditional: {
25
25
  'agentic-design': 'blocked',
26
26
  'agentic-subagent': 'blocked',
@@ -34,6 +34,7 @@ export const PROFILES = {
34
34
  'agentic-philosophy',
35
35
  'agentic-ground',
36
36
  'agentic-audit',
37
+ 'agentic-next',
37
38
  'agentic-bootstrap',
38
39
  'agentic-spec',
39
40
  'agentic-task',
@@ -60,6 +61,7 @@ export const PROFILES = {
60
61
  'agentic-audit',
61
62
  'agentic-review',
62
63
  'agentic-ground',
64
+ 'agentic-next',
63
65
  ],
64
66
  conditional: {
65
67
  'agentic-design': 'frontend',
@@ -80,6 +82,7 @@ export const PROFILES = {
80
82
  'agentic-audit',
81
83
  'agentic-review',
82
84
  'agentic-ground',
85
+ 'agentic-next',
83
86
  ],
84
87
  conditional: {
85
88
  'agentic-design': 'frontend',
@@ -26,6 +26,8 @@ export const SKILL_DESCRIPTIONS = {
26
26
  'Fresh-context code review per WORKFLOW §10 — assemble handoff, return structured findings.',
27
27
  'agentic-ground':
28
28
  'Four-source pre-implementation research (docs / OSS / in-repo / git history) + happy-path synthesis + deviation gate. WORKFLOW §4 + §5.',
29
+ 'agentic-next':
30
+ 'State survey + prioritized next-action recommendations across the four-layer artifact stack. Read-only navigation aid (`flutter doctor` pattern).',
29
31
  'agentic-design': 'Bootstrap `DESIGN.md` from existing tokens (frontend projects).',
30
32
  'agentic-subagent': 'Draft a new Claude Code subagent at `.claude/agents/<name>.md`.',
31
33
  'agentic-skill': 'Draft a new Claude Code or Codex skill at the appropriate path.',
@@ -93,18 +95,23 @@ function replaceSection(body, newSection, bounds) {
93
95
  * Behaviour:
94
96
  * - No root doc → returns { type: 'absent', path: null }. Skill bootstraps create the file later.
95
97
  * - Section already present and matches → { type: 'unchanged', path }.
96
- * - Section already present and stale → updated in place → { type: 'updated', path }.
98
+ * - Section already present and stale → confirmReplace(path) is called; on true updated → { type: 'updated', path }; on false → { type: 'kept-stale', path } (managed-section diverged on disk and the user chose to keep it).
97
99
  * - Section absent → confirmAppend(path) is called; on true → appended → { type: 'appended', path }; on false → { type: 'skipped', path }.
100
+ * - dryRun true → no writes; returned `type` reflects what *would* happen.
98
101
  *
99
102
  * @param {object} opts
100
103
  * @param {string} opts.cwd Target project root.
101
104
  * @param {string[]} opts.skills Skill names actually installed (in display order).
102
105
  * @param {(path: string) => Promise<boolean>} [opts.confirmAppend] Async confirmation callback for the append-to-existing-file case. Default: skip.
106
+ * @param {(path: string) => Promise<boolean>} [opts.confirmReplace] Async confirmation callback for the replace-existing-section case (managed section present on disk but stale). Default: replace (preserves the v0.5 behaviour where update silently regenerates the managed block on every kit / skill change). Wire to a prompt to honor user edits between markers.
107
+ * @param {boolean} [opts.dryRun] When true, computes the action without writing.
103
108
  */
104
109
  export async function updateRootDoc({
105
110
  cwd,
106
111
  skills,
107
112
  confirmAppend = async () => false,
113
+ confirmReplace = async () => true,
114
+ dryRun = false,
108
115
  }) {
109
116
  const found = findRootDoc(cwd);
110
117
  if (!found) return { type: 'absent', path: null };
@@ -116,7 +123,9 @@ export async function updateRootDoc({
116
123
  if (bounds) {
117
124
  const updated = replaceSection(body, section, bounds);
118
125
  if (updated === body) return { type: 'unchanged', path: found.name };
119
- writeFileSync(found.path, updated);
126
+ const ok = await confirmReplace(found.name);
127
+ if (!ok) return { type: 'kept-stale', path: found.name };
128
+ if (!dryRun) writeFileSync(found.path, updated);
120
129
  return { type: 'updated', path: found.name };
121
130
  }
122
131
 
@@ -124,6 +133,6 @@ export async function updateRootDoc({
124
133
  if (!ok) return { type: 'skipped', path: found.name };
125
134
 
126
135
  const sep = body.endsWith('\n') ? '\n' : '\n\n';
127
- writeFileSync(found.path, body + sep + section + '\n');
136
+ if (!dryRun) writeFileSync(found.path, body + sep + section + '\n');
128
137
  return { type: 'appended', path: found.name };
129
138
  }
package/src/lib/state.js CHANGED
@@ -77,9 +77,22 @@ export function saveState(cwd, agent, state) {
77
77
  }
78
78
 
79
79
  function orderState(state) {
80
+ if (!state || typeof state !== 'object') {
81
+ throw new Error('orderState: state must be an object');
82
+ }
83
+ if (!state.skills || typeof state.skills !== 'object') {
84
+ throw new Error(
85
+ 'orderState: state.skills must be an object (got ' + typeof state.skills + ')'
86
+ );
87
+ }
80
88
  const skills = {};
81
89
  for (const skillName of Object.keys(state.skills).sort()) {
82
90
  const entry = state.skills[skillName];
91
+ if (!entry || !Array.isArray(entry.files)) {
92
+ throw new Error(
93
+ `orderState: state.skills["${skillName}"].files must be an array`
94
+ );
95
+ }
83
96
  const files = [...entry.files].sort((a, b) => a.path.localeCompare(b.path));
84
97
  skills[skillName] = {
85
98
  version: entry.version,
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: agentic-next
3
+ description: Survey the project's state across the four-layer artifact stack and recommend prioritized next actions, modeled on `flutter doctor`. Use when the user asks "what's next", "next step", "where am I", "project status", "doctor", "what should I do", "audit my workflow", or whenever a navigation aid is needed mid-flow. Read-only; complements `agentic-audit` (drift detection, a different question). Profile-aware — `poc` suppresses Layer 2 / 3 noise, `team` / `mature` run the full survey.
4
+ allowed-tools: Read, Glob, Grep, Bash
5
+ ---
6
+
7
+ # /agentic-next
8
+
9
+ Read-only state survey + prioritized next-action recommendations. Mirrors `flutter doctor` shape: layer-by-layer status + concrete fix per finding. Complements `agentic-audit` — audit answers "is anything wrong?", next answers "what should I do?".
10
+
11
+ The skill writes nothing. Output is recommendations the user copies into the next conversation turn or the next CLI invocation.
12
+
13
+ ## Step 0 — Read state
14
+
15
+ Detect baseline:
16
+
17
+ * Profile + kit version: read `.claude/agentic-state.json` and `.agents/agentic-state.json` if present. Profile defaults to `team` per ADR-0013 when state file missing or no profile field.
18
+ * Filesystem signals at the repo root: `AGENTS.md` / `CLAUDE.md`, `ARCHITECTURE.md`, `DESIGN.md`, `WORKFLOW.md`, `README.md`, `package.json` / `pyproject.toml` / `Cargo.toml` / `go.mod`, `.husky/` / `lefthook.yml` / `.pre-commit-config.yaml`, `.github/workflows/`, `.git/HEAD` (current branch).
19
+ * Per-artifact directories: list `doc/specs/`, `doc/adr/`, `doc/tasks/`. Read each file's frontmatter (`Status:`, `Created:`, `Spec ref:` for tasks) but **not** the full body — survey is fast and broad.
20
+ * Git state: current branch, commits ahead of `main` (`git rev-list --count main..HEAD`), unpushed commits, working-tree dirtiness.
21
+
22
+ Do not parse skill bodies. Do not run tests. Do not invoke other skills. The survey is shallow by design.
23
+
24
+ ## Step 1 — Layer-by-layer status
25
+
26
+ Render four sections in this exact order. For each section, list what is present, what is in flight, what is missing or stale. Use words for status (`present`, `in flight`, `missing`, `stale`) — no emoji.
27
+
28
+ **Layer 1 — Constitution.**
29
+ - `AGENTS.md` (or `CLAUDE.md`) present?
30
+ - `WORKFLOW.md` present? (kit-shipped — should always be there)
31
+ - `ARCHITECTURE.md` present?
32
+ - `DESIGN.md` present? (frontend projects only)
33
+
34
+ **Layer 2 — Specs (`doc/specs/`).**
35
+
36
+ For each spec file, report `Status` and the count of tasks whose `Spec ref` field points at it:
37
+
38
+ ```
39
+ 0001-auth-flow.md (accepted, 0 implementing tasks)
40
+ 0002-onboarding.md (shipped, 3 tasks done)
41
+ ```
42
+
43
+ Flag specs with `Status: accepted` and zero implementing tasks — that is the most common stuck state.
44
+
45
+ **Layer 3 — Plans / Decisions.**
46
+
47
+ `doc/adr/` — count by status: `proposed`, `accepted`, `deprecated`, `superseded`. Flag any `proposed` ADRs explicitly with their slug — they need a decision.
48
+
49
+ `doc/tasks/` — count by status: `proposed`, `in-progress`, `blocked`, `done`. List in-progress and blocked tasks with their slugs and `Spec ref`. Flag tasks with no `Spec ref` and no `Board ref` as orphans (no clear scope tie).
50
+
51
+ **Layer 4 — Code.**
52
+ - Branch: `<name>` (`<n>` commits ahead of `main` if applicable).
53
+ - Tests: wired? (presence of `npm test` script / `pytest` / `cargo test` / `go test ./...`).
54
+ - Hooks: wired? (presence of `.husky/`, `lefthook.yml`, `.pre-commit-config.yaml`, or active `.git/hooks/` scripts).
55
+ - CI: wired? (presence of `.github/workflows/`, `.gitlab-ci.yml`, `.circleci/`).
56
+
57
+ ## Step 2 — Cross-cut signals
58
+
59
+ A few signals do not belong to one layer:
60
+
61
+ - **Pending fresh-context review.** If branch is ≥1 commits ahead of `main` and no `.agentic/reviews/<ts>-*.md` exists for the current range, flag `agentic-review` as a recommendation.
62
+ - **Spec ↔ task reciprocity.** Tasks with non-empty `Spec ref` whose target spec does not exist → orphan task. Specs with `Status: accepted` or `shipped` and zero entries in their `Related → Tasks` list → spec without implementing tasks.
63
+ - **Profile vs install state.** Profile says one set of skills; state file lists another. Surface the divergence and recommend `agentic update` or `agentic profile set <name>`.
64
+ - **Stale state file.** `kitVersion` in state file ≠ currently-running kit. Recommend `agentic update`.
65
+
66
+ ## Step 3 — Prioritize next actions
67
+
68
+ Rank findings by leverage. Return 3–5 concrete invocations, each as a one-line "do X next" with the slug or path that makes the action unambiguous.
69
+
70
+ Priority heuristic:
71
+
72
+ 1. **Decisions blocking work.** Proposed ADRs awaiting acceptance, accepted specs without tasks. These unblock everyone downstream.
73
+ 2. **Quality gates the profile expects.** `mature` profile + hooks not wired → recommend `/agentic-hooks`. `team` profile + hooks not wired → recommend.
74
+ 3. **In-flight work needing review.** Branch ahead of `main` without a fresh-context review → recommend `/agentic-review`.
75
+ 4. **Drift / hygiene.** Orphan tasks, state-file staleness, spec ↔ task gaps → recommend `/agentic-audit` or `agentic update`.
76
+ 5. **Greenfield gaps.** Missing `AGENTS.md` → `/agentic-bootstrap`. Missing `ARCHITECTURE.md` → `/agentic-architecture` (skip in `poc` and `solo`).
77
+
78
+ If nothing actionable surfaces, say so explicitly — empty output is real signal, not a gap. Phrase: "No urgent next action. Continue current work or invoke `/agentic-audit` for a full drift check."
79
+
80
+ ## Step 4 — Profile-aware filtering
81
+
82
+ Apply per-profile rules at the end so the user sees output matched to their maturity:
83
+
84
+ - **`poc`:** suppress Layer 2 (specs) and Layer 3 (ADRs / tasks) sections entirely if those directories do not exist. Show Layer 1 + Layer 4 only. Recommendation set: `/agentic-ground` for research, `/agentic-audit` for drift, `/agentic-update` for staleness.
85
+ - **`solo`:** Layer 2 / Layer 3 render but ADR / `ARCHITECTURE.md` absence is informational — no "needs action" flag. Specs are universal at this profile; spec-without-tasks remains a real finding.
86
+ - **`team`:** full survey. Default profile.
87
+ - **`mature`:** additionally flag hooks-not-wired louder ("WORKFLOW §11 binding for `mature` profile — `/agentic-hooks` recommended").
88
+
89
+ ## Output contract
90
+
91
+ A single Markdown message structured as:
92
+
93
+ ```
94
+ ## agentic-next
95
+
96
+ **Profile:** <name> (kit v<X.Y.Z>)
97
+ **Branch:** <name> (<n> commits ahead of main)
98
+
99
+ ### Layer 1 — Constitution
100
+ <one-line status per artifact>
101
+
102
+ ### Layer 2 — Specs (doc/specs/)
103
+ <spec list with status + task count, or "no specs">
104
+
105
+ ### Layer 3 — Plans / Decisions
106
+ <ADR + task summaries with explicit flags>
107
+
108
+ ### Layer 4 — Code
109
+ <branch / tests / hooks / CI status>
110
+
111
+ ### Recommended next (priority)
112
+ 1. <action> — <one-line reason>
113
+ 2. <action> — <one-line reason>
114
+ ...
115
+ ```
116
+
117
+ No file written. No state mutation. Recommendations are advisory; the user decides whether to invoke. Cross-references `agentic-audit` (drift detection), `agentic-update` (kit drift), `agentic-profile` (profile changes) where they apply.
118
+
119
+ When the host exposes `AskUserQuestion` (per ADR-0014) and the user follows up with a confirmation question after seeing the recommendations, prefer the structured prompt over inline text.
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: agentic-next
3
+ description: Survey the project's state across the four-layer artifact stack and recommend prioritized next actions, modeled on `flutter doctor`. Use when the user asks "what's next", "next step", "where am I", "project status", "doctor", "what should I do", "audit my workflow". Read-only; complements `agentic-audit` (drift detection, a different question). Profile-aware — `poc` suppresses Layer 2/3 noise, `team`/`mature` run the full survey.
4
+ ---
5
+
6
+ <background_information>
7
+ Read-only state survey + prioritized next-action recommendations. Mirrors `flutter doctor` shape: layer-by-layer status + concrete fix per finding. Complements `agentic-audit` — audit answers "is anything wrong?", next answers "what should I do?".
8
+
9
+ The skill writes nothing. Output is recommendations the user copies into the next conversation turn or the next CLI invocation.
10
+
11
+ Codex auto-trigger on description keywords is less mature than Claude Code's. If auto-invocation does not fire when the user asks about workflow status, invoke this skill manually.
12
+ </background_information>
13
+
14
+ <instructions>
15
+ Step 0 — read state. Detect baseline:
16
+ - Profile + kit version: read `.claude/agentic-state.json` and `.agents/agentic-state.json` if present. Profile defaults to `team` per ADR-0013 when state file missing or no profile field.
17
+ - Filesystem signals: `AGENTS.md` / `CLAUDE.md`, `ARCHITECTURE.md`, `DESIGN.md`, `WORKFLOW.md`, `README.md`, `package.json` / `pyproject.toml` / `Cargo.toml` / `go.mod`, `.husky/` / `lefthook.yml` / `.pre-commit-config.yaml`, `.github/workflows/`, current git branch.
18
+ - Per-artifact directories: list `doc/specs/`, `doc/adr/`, `doc/tasks/`. Read each file's frontmatter (`Status:`, `Created:`, `Spec ref:` for tasks) but NOT the full body.
19
+ - Git state: current branch, commits ahead of `main` (`git rev-list --count main..HEAD`), unpushed commits, working-tree dirtiness.
20
+
21
+ Do not parse skill bodies. Do not run tests. Do not invoke other skills.
22
+
23
+ Step 1 — layer-by-layer status. Render four sections in this exact order. Use words for status (`present`, `in flight`, `missing`, `stale`) — no emoji.
24
+
25
+ Layer 1 — Constitution: AGENTS.md / CLAUDE.md, WORKFLOW.md, ARCHITECTURE.md, DESIGN.md (frontend only).
26
+
27
+ Layer 2 — Specs (doc/specs/): for each file, report Status + count of tasks whose Spec ref points at it. Flag specs with Status: accepted and zero implementing tasks.
28
+
29
+ Layer 3 — Plans / Decisions: doc/adr/ counts by status, flag proposed ADRs with their slug. doc/tasks/ counts by status, list in-progress + blocked with slug and Spec ref. Flag tasks with no Spec ref and no Board ref as orphans.
30
+
31
+ Layer 4 — Code: branch + ahead count, tests wired? (npm test / pytest / cargo test / go test), hooks wired? (.husky / lefthook.yml / .pre-commit-config.yaml / .git/hooks/), CI wired? (.github/workflows / .gitlab-ci.yml / .circleci/).
32
+
33
+ Step 2 — cross-cut signals:
34
+ - Pending fresh-context review: branch ≥1 commits ahead of main with no .agentic/reviews/<ts>-*.md for the current range → recommend agentic-review.
35
+ - Spec ↔ task reciprocity: tasks with non-empty Spec ref whose target spec is missing → orphan; accepted/shipped specs with zero Related → Tasks → spec without implementing tasks.
36
+ - Profile vs install state: profile-declared skill set ≠ on-disk skill set → recommend `agentic update` or `agentic profile set <name>`.
37
+ - Stale state file: kitVersion in state file ≠ currently-running kit → recommend `agentic update`.
38
+
39
+ Step 3 — prioritize next actions. Rank by leverage. Return 3–5 concrete invocations, each as one-line "do X next" with slug / path.
40
+
41
+ Priority heuristic:
42
+ 1. Decisions blocking work (proposed ADRs, accepted specs without tasks).
43
+ 2. Quality gates the profile expects (mature + hooks not wired).
44
+ 3. In-flight work needing review (branch ahead without fresh-context review).
45
+ 4. Drift / hygiene (orphan tasks, state-file staleness, spec ↔ task gaps).
46
+ 5. Greenfield gaps (missing AGENTS.md, missing ARCHITECTURE.md — skip in poc / solo).
47
+
48
+ If nothing actionable surfaces, say so: "No urgent next action. Continue current work or invoke `/agentic-audit` for a full drift check."
49
+
50
+ Step 4 — profile-aware filtering. Apply at the end:
51
+ - poc: suppress Layer 2/3 sections if those directories do not exist. Show Layer 1 + Layer 4 only. Recommendation set: `/agentic-ground`, `/agentic-audit`, `agentic update`.
52
+ - solo: Layer 2/3 render; ADR / ARCHITECTURE.md absence is informational, not a flag. Specs are universal; spec-without-tasks remains a real finding.
53
+ - team: full survey (default).
54
+ - mature: additionally flag hooks-not-wired louder (WORKFLOW §11 binding for mature profile).
55
+ </instructions>
56
+
57
+ <output_contract>
58
+ A single Markdown message structured as:
59
+
60
+ ```
61
+ ## agentic-next
62
+
63
+ **Profile:** <name> (kit v<X.Y.Z>)
64
+ **Branch:** <name> (<n> commits ahead of main)
65
+
66
+ ### Layer 1 — Constitution
67
+ <one-line status per artifact>
68
+
69
+ ### Layer 2 — Specs (doc/specs/)
70
+ <spec list with status + task count, or "no specs">
71
+
72
+ ### Layer 3 — Plans / Decisions
73
+ <ADR + task summaries with explicit flags>
74
+
75
+ ### Layer 4 — Code
76
+ <branch / tests / hooks / CI status>
77
+
78
+ ### Recommended next (priority)
79
+ 1. <action> — <one-line reason>
80
+ 2. <action> — <one-line reason>
81
+ ```
82
+
83
+ No file written. No state mutation. Recommendations are advisory; the user decides whether to invoke. Cross-references `agentic-audit` (drift detection), `agentic-update` (kit drift), `agentic-profile` (profile changes) where they apply.
84
+ </output_contract>
@@ -0,0 +1,5 @@
1
+ interface:
2
+ display_name: agentic-next
3
+ short_description: State-aware navigation aid (flutter doctor pattern). Surveys four-layer artifact stack + recommends prioritized next actions. Read-only.
4
+ policy:
5
+ allow_implicit_invocation: false