@vpxa/aikit 0.1.381 → 0.1.383

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.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/packages/claude-desktop/dist/manifest.json +1 -1
  3. package/packages/cli/dist/index.js +3 -3
  4. package/packages/cli/dist/{init-Be3nyugf.js → init-DMj2ctyd.js} +1 -1
  5. package/packages/cli/dist/{templates-CK9mSHyJ.js → templates-DLra78_O.js} +10 -10
  6. package/packages/server/dist/bin.js +1 -1
  7. package/packages/server/dist/{config-CTYSUkDf.js → config-CQKoGfwD.js} +1 -1
  8. package/packages/server/dist/{config-Bz8Uyzuq.js → config-DX1KYSbN.js} +1 -1
  9. package/packages/server/dist/{dashboard-static-BbHMHkQ3.js → dashboard-static-C6RP0VA7.js} +1 -1
  10. package/packages/server/dist/{dashboard-static-gAOiHHqI.js → dashboard-static-DdsIJd-u.js} +1 -1
  11. package/packages/server/dist/index.js +1 -1
  12. package/packages/server/dist/{register-tools-0E-d3SIk.js → register-tools-BGFt0C77.js} +149 -148
  13. package/packages/server/dist/{register-tools-fdniAqWz.js → register-tools-RwhtWli2.js} +146 -147
  14. package/packages/server/dist/{server-C4qsakCZ.js → server-CJw04C9E.js} +6 -6
  15. package/packages/server/dist/{server-DHdcyAmX.js → server-DxiekvQV.js} +6 -6
  16. package/packages/server/dist/{server-http-CC39yGVF.js → server-http-CpGB2imV.js} +1 -1
  17. package/packages/server/dist/{server-http-DlTdz6ch.js → server-http-DjE5LRrG.js} +1 -1
  18. package/packages/server/dist/{server-stdio-Colzu8Wb.js → server-stdio-BN_gzRqw.js} +1 -1
  19. package/packages/server/dist/{server-stdio-CTbBp6wO.js → server-stdio-DTcX2U0-.js} +1 -1
  20. package/packages/server/dist/{settings-static-DV2hXZgq.js → settings-static-C0oT3Ctk.js} +1 -1
  21. package/packages/server/dist/{settings-static-PjpMR9Q7.js → settings-static-DVMG47Oh.js} +1 -1
  22. package/packages/server/dist/startup-maintenance-cbRSFMY5.js +21 -0
  23. package/packages/server/dist/startup-maintenance-kHH8tjds.js +20 -0
  24. package/packages/tools/dist/index.d.ts +41 -2
  25. package/packages/tools/dist/index.js +105 -106
  26. package/scaffold/dist/definitions/bodies.mjs +21 -16
  27. package/scaffold/dist/definitions/flows.mjs +5 -5
  28. package/scaffold/dist/definitions/protocols.mjs +11 -11
  29. package/scaffold/dist/definitions/skills/aikit.mjs +2 -158
  30. package/scaffold/dist/definitions/skills/c4-architecture.mjs +5 -5
  31. package/scaffold/dist/definitions/skills/docs.mjs +12 -10
  32. package/scaffold/dist/definitions/skills/multi-agents-development.mjs +4 -4
  33. package/scaffold/dist/definitions/skills/orchestrator.mjs +8 -3
  34. package/packages/server/dist/startup-maintenance-BnTozHs1.js +0 -21
  35. package/packages/server/dist/startup-maintenance-CxAICs-n.js +0 -20
@@ -7,8 +7,9 @@ ${t.map((e,t)=>` ${t+1}. ${e}`).join(`
7
7
  Execute these MCP calls at session start, before ANY other work:
8
8
 
9
9
  1. \`mcp__aikit__flow({ action: 'status' })\` — Check active flow state.
10
- 2. \`mcp__aikit__status({ includePrelude: true })\` — Load L0 workspace context (compact summary).
11
- 3. If workspaceCore is null → \`mcp__aikit__onboard({ path: "." })\` first, then status again.
10
+ 2. \`mcp__aikit__status({ includePrelude: true })\` — Load workspace skill + onboard context.
11
+ 3. If \`onboarded\` is false or \`onboard_context\` is null → \`mcp__aikit__onboard({ path: ".", mode: "generate" })\` first, then status again.
12
+ 4. If \`onboard_context.freshness.status\` is \`stale\` or \`unknown\`, or \`nextAction.kind === "update_onboard"\` → \`mcp__aikit__onboard({ path: ".", update: true })\` first, then status again.
12
13
 
13
14
  **Failure to execute these before any other action is a protocol violation.**
14
15
 
@@ -34,9 +35,13 @@ Auto-clarity exception: use fuller prose for security warnings, irreversible con
34
35
 
35
36
  When dispatching subagents, include this line: "Communication style: terse like smart caveman; technical substance intact; no filler; auto-clarity exception for security/irreversible/misread-prone sequences."
36
37
 
38
+ ## User-Facing Presentation
39
+
40
+ Use \`present({ schemaVersion: 1, title, blocks })\` for almost every substantive user response. If the response is more than 3 sentences, contains a list/table/checklist/plan/status/verdict/summary/progress/evidence map, or asks for approval/choice, use \`present\`. Prefer \`present\` even without actions for read-only summaries; add \`actions\` for approvals, confirmations, and selections. Plain text only for tiny status updates or one simple question that fits in 3 short sentences.
41
+
37
42
  ## Bootstrap
38
- 1. status({ includePrelude: true }) -> onboard({ path: "." }) if needed.
39
- 1a. For flow dispatch: status({ includePrelude: true }) → if onboard missing or workspace stale, onboard({ path: ".", update: true }) before any subagent dispatch.
43
+ 1. status({ includePrelude: true }) -> onboard({ path: ".", mode: "generate" }) if missing.
44
+ 1a. For flow dispatch: status({ includePrelude: true }) → if \`onboard_context\` missing, generate onboard; if \`onboard_context.freshness.status\` is \`stale\` or \`unknown\`, run onboard({ path: ".", update: true }) before any subagent dispatch.
40
45
  2. Apply layered knowledge protocol (see below).<!-- layered-header -->
41
46
  3. search({ query: "SESSION CHECKPOINT", origin: "curated" }) before planning.
42
47
  5. Load skills by trigger: aikit always; multi-agents-development before delegation; present before non-tiny output (preferBrowser=true by default; set preferBrowser:false for inline rendering — auto-falls back to browser if client doesn't support inline); brainstorming for design decisions.
@@ -70,7 +75,7 @@ Classify each step by agent role:
70
75
  For Mixed flows, each step inherits classification from its dispatched agent. Write-capable agents get \`readonly: false\`; all others \`readonly: true\`.
71
76
 
72
77
  ### Pre-Dispatch Staleness Check
73
- Before dispatching a write-capable agent, run \`status({ includePrelude: true })\` to verify onboard freshness. If workspace structure changed since last onboard (new/deleted/modified files), run \`onboard({ path: ".", update: true })\` first. Read-only dispatches skip this check (0 token cost). The \`readonly\` flag is a contractual convention, not runtime enforcement — subagents retain full MCP tool access.
78
+ Before dispatching a write-capable agent, run \`status({ includePrelude: true })\` to verify onboard freshness. If \`onboard_context\` is missing, generate it; if \`onboard_context.freshness.status\` is \`stale\` or \`unknown\`, run \`onboard({ path: ".", update: true })\` first. Read-only dispatches skip this check (0 token cost). The \`readonly\` flag is a contractual convention, not runtime enforcement — subagents retain full MCP tool access.
74
79
 
75
80
  ## Protocol Coverage Map
76
81
  - conversation-compression: before each dispatch batch, withdraw/profile context; after each batch, deposit status/files/decisions/blockers; never echo raw subagent output.
@@ -107,16 +112,16 @@ Every \`runSubagent\` prompt includes all of:
107
112
 
108
113
  1. **Agent + Goal** — exact specialist name, testable acceptance criteria.
109
114
  2. **Files + Boundary** — target files, do-not-touch list.
110
- 3. **Arch Context** — Pre-compress with AI Kit tools before including in prompt. pick by token budget: efficient → \`file_summary\` (T1=structure, T2=content), full → \`digest\`. Default efficient. **Never pass raw file contents — always compress first.** This eliminates subagent need for \`read_file\`.
115
+ 3. **Arch Context** — Pre-compress with AI Kit tools before including in prompt. pick by token budget: efficient → \`file_summary\` (T1=structure, T2=content), full → \`digest\`. Default efficient. **Never pass raw file contents — always compress first.** This eliminates subagent need for \`read_file\`.
111
116
  4. **Prior Knowledge** — \`knowledge({ action: "lesson", subAction: "list-lessons", topic: "<2-3 keywords>", minConfidence: 70 })\` + \`search({ query: "<task area>", category: "conventions", limit: 3 })\`. Include high-confidence results. Skip for Floor.
112
117
  5. **Artifacts Path** — active flow's run dir / artifacts path from \`flow({ action: 'status' })\`.
113
118
  6. **FORGE** — tier (from forge_classify), task_id, evidence requirements. Pass tier directly; Documenter/SKILL.md maps tier to docs generation depth internally. Reviewers add CRITICAL/HIGH claims into your task_id; never create their own.
114
- 7. **Flow Context** — "Call \`knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })\` as your FIRST action. Reuse withdrawn refs and L0 card refs before broad retrieval. Do NOT independently reload workspace-core or architecture cards when dispatch already carries applicable refs."
115
- 8. ${i().replace(/\n/g,`
119
+ 7. **Flow Context** — "Call \`knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })\` as your FIRST action. Reuse withdrawn refs plus supplied workspace skill/onboard context before broad retrieval. Do NOT independently rediscover repo basics when dispatch already carries applicable refs."
120
+ 8. ${i().replace(/\n/g,`
116
121
  `)}
117
- 9. **Self-Review** — checklist before declaring status: scope respected? tests pass? conventions followed?
118
- 10. **Return contract** — \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`. ≤200 words: status, files, decisions. Full detail only if BLOCKED.
119
- 11. **Read-Only Mode** — \`readonly: true|false\`. Controls whether agent may modify files. Derived from flow type + step classification. Write-capable agents (Implementer, Refactor, Frontend, Debugger) receive \`false\`; all others \`true\`. Contractual convention — no runtime enforcement.
122
+ 9. **Self-Review** — checklist before declaring status: scope respected? tests pass? conventions followed?
123
+ 10. **Return contract** — \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`. ≤200 words: status, files, decisions. Full detail only if BLOCKED.
124
+ 11. **Read-Only Mode** — \`readonly: true|false\`. Controls whether agent may modify files. Derived from flow type + step classification. Write-capable agents (Implementer, Refactor, Frontend, Debugger) receive \`false\`; all others \`true\`. Contractual convention — no runtime enforcement.
120
125
 
121
126
  Always pass \`agentName\`. Missing/empty is a dispatch bug.
122
127
 
@@ -126,7 +131,7 @@ Always pass \`agentName\`. Missing/empty is a dispatch bug.
126
131
 
127
132
  | Need | Use |
128
133
  |------|-----|
129
- | L0 session briefing | \`status({ includePrelude: true })\` — workspace-core available after \`onboard()\`. Flow card via flow context. |
134
+ | Workspace session context | \`status({ includePrelude: true })\` — workspace skill + onboard context available after \`onboard()\`. Flow context via L1 withdrawal. |
130
135
  | Assess scope before dispatch | \`file_summary\` |
131
136
  | Pre-populate subagent with context | \`file_summary\` |
132
137
  | L1 flow withdrawal | \`knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })\` — reuse before broad retrieval |
@@ -134,14 +139,14 @@ Always pass \`agentName\`. Missing/empty is a dispatch bug.
134
139
  | L3 evidence/provenance | \`search({ query })\` + \`knowledge({ action: 'lesson' })\` — focused retrieval only |
135
140
  | Understand error during emergency | \`file_summary({ files, tier: 'T2', query })\` — never raw-read |
136
141
  | Between phases: compress state | \`session_digest({ persist: true, focus: "<topic>" })\` |
137
- | After batch: persist summary | \`knowledge({ action: 'remember', scope: 'flow', ... })\` |
142
+ | After batch: persist summary | \`knowledge({ action: 'remember', scope: 'flow', ... })\` |
138
143
 
139
144
  \`read_file\` is ONLY for exact edit lines. Or when diagnosing an emergency with \`git diff --stat\` + \`check({})\`. No exceptions for planning or discovery.
140
145
 
141
146
  ## Evidence + Validation
142
147
  Use forge_classify for tier. Standard+ creates one Orchestrator-owned evidence_map task_id; reviewers add CRITICAL/HIGH claims into it; only Orchestrator runs gate.
143
148
  After implementation batches: check({}) + test_run({}) once, then blast_radius for shared/public changes.
144
- After write flow completion: onboard({ path, update: true }) → reindex({}) → produce_knowledge({}) to sync L0 cards and vector index. Verify with status({}). Read-only/Epilogue-only flows skip (0 token cost). If re-onboard fails, log warning and surface in flow status — do not block.
149
+ After write flow completion: onboard({ path, update: true }) → reindex({}) → produce_knowledge({}) to refresh onboard context, workspace skill inputs, and vector index. Verify with status({}). Read-only/Epilogue-only flows skip (0 token cost). If re-onboard fails, log warning and surface in flow status — do not block.
145
150
 
146
151
  ## Presentation
147
152
  Use present for summaries, reports, evidence maps, task plans, batch results, verdicts, progress, reviews, approval gates. Plain chat only for <=2 short status sentences or one simple question.
@@ -160,7 +165,7 @@ Use present for summaries, reports, evidence maps, task plans, batch results, ve
160
165
  Use web_fetch/http first. On auth failure, load repo-access; if exhausted, use AI Kit browser. Do not use system browser for agent-visible verification.
161
166
 
162
167
  ## End
163
- - After write flows: onboard({ path, update: true }) → reindex({}) → produce_knowledge({}). L0 card regen via \`briefing-card-compiler\` if structural change detected.
168
+ - After write flows: onboard({ path, update: true }) → reindex({}) → produce_knowledge({}). Refresh workspace skill/onboard context if structural change detected.
164
169
  - After read-only/epilogue-only flows: no reindex (0 token cost). remember decisions as normal.
165
170
  - If re-onboard/reindex fails: log warning, surface in flow status, do not block.
166
171
  - Flow-derived promotion: evidence-backed promotion candidates from final consolidation; confidence alone never promotes.
@@ -239,7 +244,7 @@ Use web_fetch/http first. On auth failure, load repo-access; if exhausted, use A
239
244
  ## Pre-Edit Checklist
240
245
 
241
246
  1. **Understand consumers** — \`graph({action:'find_nodes', name_pattern:'<target>'})\` → \`graph({action:'neighbors', node_id, direction:'incoming'})\`
242
- 2. **Compress, don't raw-read (HARD RULE)** — If you catch yourself about to call \`read_file\`, stop. Choose \`file_summary({ files, tier: 'T1', query })\` for structure-only, or \`file_summary({ files, tier: 'T2', query })\` for structure+content — one call, pick the right tier. \`read_file\` is ONLY for exact line content before \`replace_string_in_file\` — never for exploration or understanding.
247
+ 2. **Compress, don't raw-read (HARD RULE)** — If you catch yourself about to call \`read_file\`, stop. Choose \`file_summary({ files, tier: 'T1', query })\` for structure-only, or \`file_summary({ files, tier: 'T2', query })\` for structure+content — one call, pick the right tier. \`read_file\` is ONLY for exact line content before \`replace_string_in_file\` — never for exploration or understanding.
243
248
  3. **Snapshot risky edits** — \`checkpoint({action:'save', label:'pre-<scope>'})\` before cross-cutting changes
244
249
  4. **Estimate blast radius** — run \`blast_radius\` before and after shared/public symbol changes
245
250
  5. **TDD when tests exist** — failing test first, then minimum code
@@ -1,5 +1,5 @@
1
1
  const e=e=>!e||e.length===0?``:`**Skills for this step:** ${e.map(e=>`\`${e}\``).join(`, `)}.
2
- Load them when their preconditions are met.`,t={design:{contextProfile:`researcher`,l0CardTypes:[`workspace-core`,`architecture`],l1Fields:[`objective`,`acceptanceCriteria`,`scope`,`exclusions`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`decisions`,`retrievedRefs`,`summary`],candidateLearnings:[`Architectural decisions with evidence`,`Scope boundary lessons`],handoffArtifact:`design-decisions.md`,handoffFields:[`decisions`,`scope`,`exclusions`,`retrievedRefs`]},spec:{contextProfile:`researcher`,l0CardTypes:[`workspace-core`],l1Fields:[`objective`,`acceptanceCriteria`,`decisions`,`scope`],l2Refs:`required`,l3Evidence:`none`,updates:[`acceptanceCriteria`,`decisions`,`unresolvedClaims`],candidateLearnings:[`Requirement ambiguity lessons when evidenced`,`Contract boundary clarity`],handoffArtifact:`spec.md`,handoffFields:[`acceptanceCriteria`,`scope`,`decisions`]},plan:{contextProfile:`implementer`,l0CardTypes:[`workspace-core`,`architecture`],l1Fields:[`acceptanceCriteria`,`scope`,`decisions`,`retrievedRefs`],l2Refs:`required`,l3Evidence:`none`,updates:[`decisions`,`artifacts`,`stepSummaries`],candidateLearnings:[`Planning pattern when reusable and evidenced`],handoffArtifact:`plan.md`,handoffFields:[`artifacts`,`decisions`]},task:{contextProfile:`implementer`,l0CardTypes:[`workspace-core`],l1Fields:[`acceptanceCriteria`,`scope`,`decisions`,`retrievedRefs`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`artifacts`,`stepSummaries`],candidateLearnings:[],handoffArtifact:`tasks.md`,handoffFields:[`artifacts`,`stepSummaries`]},execute:{contextProfile:`implementer`,l0CardTypes:[],l1Fields:[`artifacts`,`scope`,`retrievedRefs`],l2Refs:`on-demand`,l3Evidence:`on-demand`,updates:[`artifacts`,`summaries`,`failures`,`successPatterns`,`verifiedClaims`,`assumedClaims`],candidateLearnings:[`Candidate only — no promotion`],handoffArtifact:`progress.md`,handoffFields:[`artifacts`,`summaries`,`failures`,`successPatterns`]},verify:{contextProfile:`reviewer`,l0CardTypes:[],l1Fields:[`acceptanceCriteria`,`artifacts`,`verifiedClaims`,`assumedClaims`,`unresolvedClaims`],l2Refs:`on-demand`,l3Evidence:`required`,updates:[`verifiedClaims`,`unresolvedClaims`,`verifiedFinalOutcome`],candidateLearnings:[`Confirm or reject candidates — no direct promotion`],handoffArtifact:`verify-report.md`,handoffFields:[`verifiedClaims`,`verifiedFinalOutcome`]},"basic-design":{contextProfile:`researcher`,l0CardTypes:[`workspace-core`],l1Fields:[`objective`,`acceptanceCriteria`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`decisions`,`summary`],candidateLearnings:[],handoffArtifact:`design-decisions.md`,handoffFields:[`decisions`]},assess:{contextProfile:`implementer`,l0CardTypes:[`workspace-core`],l1Fields:[`objective`,`scope`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`summary`,`retrievedRefs`],candidateLearnings:[],handoffArtifact:`assessment.md`,handoffFields:[`scope`,`retrievedRefs`]},"basic-implement":{contextProfile:`implementer`,l0CardTypes:[],l1Fields:[`scope`,`retrievedRefs`],l2Refs:`on-demand`,l3Evidence:`on-demand`,updates:[`artifacts`,`summaries`,`verifiedClaims`],candidateLearnings:[`Candidate only — no promotion`],handoffArtifact:`progress.md`,handoffFields:[`artifacts`,`summaries`]},"basic-verify":{contextProfile:`reviewer`,l0CardTypes:[],l1Fields:[`acceptanceCriteria`,`artifacts`,`verifiedClaims`],l2Refs:`none`,l3Evidence:`required`,updates:[`verifiedClaims`,`verifiedFinalOutcome`],candidateLearnings:[],handoffArtifact:`verify-report.md`,handoffFields:[`verifiedFinalOutcome`]},"docs-sync":{contextProfile:`documenter`,l0CardTypes:[],l1Fields:[`artifacts`,`stepSummaries`,`candidateLearnings`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[],candidateLearnings:[`L2 candidate mapping from durable doc changes`],handoffArtifact:``,handoffFields:[]},"lesson-learned":{contextProfile:`documenter`,l0CardTypes:[],l1Fields:[`failures`,`successPatterns`,`candidateLearnings`,`verifiedFinalOutcome`],l2Refs:`none`,l3Evidence:`on-demand`,updates:[],candidateLearnings:[`Evidence-backed candidate learnings into L1/L3`],handoffArtifact:``,handoffFields:[]}},n="### Dispatch Protocol\n- **Max 2 corrective retries** per task, then escalate.\n- Use `knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })` before dispatching.\n- Context: `file_summary` (T1=structure, T2=structure+content), `digest` for multi-file synthesis.\n- Subagents: `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED`. No `present`. No flow advance.",r='### Evidence Gate\nStandard/Critical: Use one stable `task_id` (from Design/Assessment).\n1. `evidence_map({ action: "create", task_id: "<slug>", tier: "<tier>" })` — create once.\n2. Add CRITICAL/HIGH claims during implementation and review.\n3. Orchestrator calls `evidence_map({ action: "gate", task_id: "<slug>" })` → YIELD/HOLD/HARD_BLOCK.\n4. HOLD → fix, re-gate (max 2 retries). HARD_BLOCK → escalate.',i={_epilogue:[{file:`steps/docs-sync/README.md`,content:`---
2
+ Load them when their preconditions are met.`,t={design:{contextProfile:`researcher`,workspaceContextInputs:[`workspace-skill`,`onboard-context`,`onboard-architecture`],l1Fields:[`objective`,`acceptanceCriteria`,`scope`,`exclusions`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`decisions`,`retrievedRefs`,`summary`],candidateLearnings:[`Architectural decisions with evidence`,`Scope boundary lessons`],handoffArtifact:`design-decisions.md`,handoffFields:[`decisions`,`scope`,`exclusions`,`retrievedRefs`]},spec:{contextProfile:`researcher`,workspaceContextInputs:[`workspace-skill`,`onboard-context`],l1Fields:[`objective`,`acceptanceCriteria`,`decisions`,`scope`],l2Refs:`required`,l3Evidence:`none`,updates:[`acceptanceCriteria`,`decisions`,`unresolvedClaims`],candidateLearnings:[`Requirement ambiguity lessons when evidenced`,`Contract boundary clarity`],handoffArtifact:`spec.md`,handoffFields:[`acceptanceCriteria`,`scope`,`decisions`]},plan:{contextProfile:`implementer`,workspaceContextInputs:[`workspace-skill`,`onboard-context`,`onboard-architecture`],l1Fields:[`acceptanceCriteria`,`scope`,`decisions`,`retrievedRefs`],l2Refs:`required`,l3Evidence:`none`,updates:[`decisions`,`artifacts`,`stepSummaries`],candidateLearnings:[`Planning pattern when reusable and evidenced`],handoffArtifact:`plan.md`,handoffFields:[`artifacts`,`decisions`]},task:{contextProfile:`implementer`,workspaceContextInputs:[`workspace-skill`,`onboard-context`],l1Fields:[`acceptanceCriteria`,`scope`,`decisions`,`retrievedRefs`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`artifacts`,`stepSummaries`],candidateLearnings:[],handoffArtifact:`tasks.md`,handoffFields:[`artifacts`,`stepSummaries`]},execute:{contextProfile:`implementer`,workspaceContextInputs:[],l1Fields:[`artifacts`,`scope`,`retrievedRefs`],l2Refs:`on-demand`,l3Evidence:`on-demand`,updates:[`artifacts`,`summaries`,`failures`,`successPatterns`,`verifiedClaims`,`assumedClaims`],candidateLearnings:[`Candidate only — no promotion`],handoffArtifact:`progress.md`,handoffFields:[`artifacts`,`summaries`,`failures`,`successPatterns`]},verify:{contextProfile:`reviewer`,workspaceContextInputs:[],l1Fields:[`acceptanceCriteria`,`artifacts`,`verifiedClaims`,`assumedClaims`,`unresolvedClaims`],l2Refs:`on-demand`,l3Evidence:`required`,updates:[`verifiedClaims`,`unresolvedClaims`,`verifiedFinalOutcome`],candidateLearnings:[`Confirm or reject candidates — no direct promotion`],handoffArtifact:`verify-report.md`,handoffFields:[`verifiedClaims`,`verifiedFinalOutcome`]},"basic-design":{contextProfile:`researcher`,workspaceContextInputs:[`workspace-skill`,`onboard-context`],l1Fields:[`objective`,`acceptanceCriteria`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`decisions`,`summary`],candidateLearnings:[],handoffArtifact:`design-decisions.md`,handoffFields:[`decisions`]},assess:{contextProfile:`implementer`,workspaceContextInputs:[`workspace-skill`,`onboard-context`],l1Fields:[`objective`,`scope`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[`summary`,`retrievedRefs`],candidateLearnings:[],handoffArtifact:`assessment.md`,handoffFields:[`scope`,`retrievedRefs`]},"basic-implement":{contextProfile:`implementer`,workspaceContextInputs:[],l1Fields:[`scope`,`retrievedRefs`],l2Refs:`on-demand`,l3Evidence:`on-demand`,updates:[`artifacts`,`summaries`,`verifiedClaims`],candidateLearnings:[`Candidate only — no promotion`],handoffArtifact:`progress.md`,handoffFields:[`artifacts`,`summaries`]},"basic-verify":{contextProfile:`reviewer`,workspaceContextInputs:[],l1Fields:[`acceptanceCriteria`,`artifacts`,`verifiedClaims`],l2Refs:`none`,l3Evidence:`required`,updates:[`verifiedClaims`,`verifiedFinalOutcome`],candidateLearnings:[],handoffArtifact:`verify-report.md`,handoffFields:[`verifiedFinalOutcome`]},"docs-sync":{contextProfile:`documenter`,workspaceContextInputs:[],l1Fields:[`artifacts`,`stepSummaries`,`candidateLearnings`],l2Refs:`on-demand`,l3Evidence:`none`,updates:[],candidateLearnings:[`L2 candidate mapping from durable doc changes`],handoffArtifact:``,handoffFields:[]},"lesson-learned":{contextProfile:`documenter`,workspaceContextInputs:[],l1Fields:[`failures`,`successPatterns`,`candidateLearnings`,`verifiedFinalOutcome`],l2Refs:`none`,l3Evidence:`on-demand`,updates:[],candidateLearnings:[`Evidence-backed candidate learnings into L1/L3`],handoffArtifact:``,handoffFields:[]}},n="### Dispatch Protocol\n- **Max 2 corrective retries** per task, then escalate.\n- Use `knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })` before dispatching.\n- Context: `file_summary` (T1=structure, T2=structure+content), `digest` for multi-file synthesis.\n- Subagents: `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED`. No `present`. No flow advance.",r='### Evidence Gate\nStandard/Critical: Use one stable `task_id` (from Design/Assessment).\n1. `evidence_map({ action: "create", task_id: "<slug>", tier: "<tier>" })` — create once.\n2. Add CRITICAL/HIGH claims during implementation and review.\n3. Orchestrator calls `evidence_map({ action: "gate", task_id: "<slug>" })` → YIELD/HOLD/HARD_BLOCK.\n4. HOLD → fix, re-gate (max 2 retries). HARD_BLOCK → escalate.',i={_epilogue:[{file:`steps/docs-sync/README.md`,content:`---
3
3
  name: _docs-sync
4
4
  description: Synchronize project documentation after flow completion
5
5
  skills: [docs]
@@ -25,7 +25,7 @@ Follow the \`docs\` skill's **Flow-Aware Sync** workflow:
25
25
 
26
26
  ## Knowledge Contract
27
27
 
28
- Profile: \`documenter\`. Reads L1 artifacts and step summaries, retrieves L2 on demand, produces L2 candidate mappings from durable doc changes. Does not write to L0 or L3.
28
+ Profile: \`documenter\`. Reads L1 artifacts and step summaries, retrieves L2 on demand, produces L2 candidate mappings from durable doc changes. Does not write to workspace context or L3.
29
29
 
30
30
  ## Completion Criteria
31
31
 
@@ -276,7 +276,7 @@ Write \`{{artifacts_path}}/design-decisions.md\` to disk. **You MUST create this
276
276
 
277
277
  ## Knowledge Contract
278
278
 
279
- This step has a \`researcher\` context profile. It loads \`workspace-core\` and \`architecture\` L0 cards, reads objective/criteria/scope from L1, retrieves L2 on demand, and seeds design decisions into L1. Architectural decisions with evidence are learning candidates.
279
+ This step has a \`researcher\` context profile. It uses workspace skill plus onboard architecture context, reads objective/criteria/scope from L1, retrieves L2 on demand, and seeds design decisions into L1. Architectural decisions with evidence are learning candidates.
280
280
 
281
281
  ## Produces
282
282
 
@@ -965,7 +965,7 @@ ${n}
965
965
 
966
966
  ## Knowledge Contract
967
967
 
968
- This step has an \`implementer\` context profile. It loads \`workspace-core\`, reads objective and scope from L1, and retrieves L2 on demand.
968
+ This step has an \`implementer\` context profile. It uses workspace skill plus onboard context, reads objective and scope from L1, and retrieves L2 on demand.
969
969
 
970
970
  ## Completion Criteria
971
971
 
@@ -1065,7 +1065,7 @@ Write \`{{artifacts_path}}/design-decisions.md\` to disk. **You MUST create this
1065
1065
 
1066
1066
  ## Knowledge Contract
1067
1067
 
1068
- This step has a \`researcher\` context profile. It loads \`workspace-core\` L0 cards and seeds decisions into L1.
1068
+ This step has a \`researcher\` context profile. It uses workspace skill plus onboard context and seeds decisions into L1.
1069
1069
 
1070
1070
  ## Produces
1071
1071
 
@@ -19,40 +19,40 @@ ${e===`<PROFILE>`?`**Profile:** Check your role → implementer | documenter | r
19
19
 
20
20
  ---`}function n(){return"\n## Evidence Citation Protocol (tier-aware)\n\nNo FORGE `task_id` → skip `evidence_map`; use `file:line` citations only.\nDo not create your own `task_id` or run the gate.\n\n| Tier | Your responsibility |\n|------|---------------------|\n| Floor | Findings with `file.ts#Lxx` citations. No `evidence_map`. |\n| Standard | Add 2-4 CRITICAL/HIGH findings with receipts. |\n| Critical | Add all CRITICAL/HIGH findings; tag contract/security claims with `safety_gate`. |\n\n**Every response MUST include:**\n- `**FORGE Task ID:** <task_id>` (passed in by Orchestrator, or state \"not provided\")\n- `**Tier applied:** Floor | Standard | Critical`\n- `**Findings:** <list>` with `file:line` receipts\n- Verdict: `APPROVED` | `CHANGES_REQUESTED` | `BLOCKED`\n\nDo NOT create a new `evidence_map`, run `evidence_map({action:'gate'})`, or add non-critical noise."}function r(...e){return e.filter(Boolean).join(`
21
21
 
22
- `)}function i({title:e=`Knowledge Recall`,intro:t,commands:n,followUp:i}={}){let a=[``,`### Retrieval-First Knowledge Access`,``,`**Always follow progressive discovery: L0 → exact-topic search/refs → broad scans.**`,``,"1. **Start with L0** — `status({ includePrelude: true })` or `aikit://skill/SKILL.md` resource",'2. **Search exact topic** — `search({ query: "<specific-topic>" })` — results include `ctxc_` refs','3. **Reuse refs** — `file_summary({ ref: "ctxc_<hash>" })` restores context without re-running search',"4. **Use `enrich: true`** on search/find/symbol for graph context without extra round-trip",`5. **Broad scan last resort** — only use find/glob/raw reads when L0 + exact search + refs fail`,``,`> **Note:** L1 (flow working-context withdrawal) is handled by your Orchestrator before dispatch —`,'> do not re-withdraw `knowledge({ scope: "flow" })` yourself. L2 (curated) is covered by step 2 above.',``].join(`
22
+ `)}function i({title:e=`Knowledge Recall`,intro:t,commands:n,followUp:i}={}){let a=[``,`### Retrieval-First Knowledge Access`,``,`**Always follow progressive discovery: workspace context → exact-topic search/refs → broad scans.**`,``,'1. **Start with workspace context** — `status({ includePrelude: true })`; if `onboard_context` is missing run `onboard({ path: ".", mode: "generate" })`; if `onboard_context.freshness.status` is `stale` or `unknown` run `onboard({ path: ".", update: true })`; read `aikit://skill/SKILL.md` only when full guidance is needed','2. **Search exact topic** — `search({ query: "<specific-topic>" })` — results include `ctxc_` refs','3. **Reuse refs** — `file_summary({ ref: "ctxc_<hash>" })` restores context without re-running search',"4. **Use `enrich: true`** on search/find/symbol for graph context without extra round-trip",`5. **Broad scan last resort** — only use find/glob/raw reads when workspace context + exact search + refs fail`,``,`> **Note:** L1 (flow working-context withdrawal) is handled by your Orchestrator before dispatch —`,'> do not re-withdraw `knowledge({ scope: "flow" })` yourself. L2 (curated) is covered by step 2 above.',``].join(`
23
23
  `);return r(`## Pre-Task: ${e} (MANDATORY)`,t,["```",...(Array.isArray(n)?n:[n]).filter(Boolean),"```"].join(`
24
- `),i,a)}function a(){return r(`## Post-Task: Capture Lesson`,`**HARD RULE:** Before DONE, capture 1-2 lessons unless change is pure config/formatting.`,'Quick capture:\n```\nknowledge({ action: "lesson", subAction: "create", context: "<what situation you faced>", insight: "<what principle the solution demonstrates>", evidence: "<file:line or commit that proves it>", confidence: 65 })\n```',"If recalled lesson was confirmed/invalid, use `confirm` or `contradict`.")}const o=1,s=Object.freeze({version:1,l0MemoriesDir:`memories`,sessionStart:{requiredCards:[`workspace-core`],maxAdditionalCards:1,activeFlowPreference:`workflow-card`,totalTokenBudget:2100},retrievalOrder:[`l0`,`l1`,`l2-on-demand`,`l3-evidence-only`],noFlowFallback:`l0-plus-l2-with-turn-local-context`,degradedFallback:`prelude-manifest-canonical-markdown`,lifecycleAuthority:`opaque-owner-capability`,autoKnowledgeMode:`observer-only`,l0Budgets:Object.freeze({"workspace-core":{min:800,max:1200},architecture:{min:600,max:900},"testing-release":{min:600,max:900},"known-issues":{min:400,max:700},"workflow:*":{min:500,max:900}})});function c(e={}){let{audience:t=`agent`}=e,n=s,r=`## Layered Knowledge Protocol (v${n.version})
24
+ `),i,a)}function a(){return r(`## Post-Task: Capture Lesson`,`**HARD RULE:** Before DONE, capture 1-2 lessons unless change is pure config/formatting.`,'Quick capture:\n```\nknowledge({ action: "lesson", subAction: "create", context: "<what situation you faced>", insight: "<what principle the solution demonstrates>", evidence: "<file:line or commit that proves it>", confidence: 65 })\n```',"If recalled lesson was confirmed/invalid, use `confirm` or `contradict`.")}const o=1,s=Object.freeze({version:1,workspaceContextDir:`onboard`,sessionStart:{requiredSurfaces:[`workspace-skill`,`onboard-context`],maxAdditionalSurfaces:1,activeFlowPreference:`flow-context`,totalTokenBudget:2100},retrievalOrder:[`workspace-context`,`l1`,`l2-on-demand`,`l3-evidence-only`],noFlowFallback:`workspace-context-plus-l2-with-turn-local-context`,degradedFallback:`prelude-manifest-canonical-markdown`,lifecycleAuthority:`opaque-owner-capability`,autoKnowledgeMode:`observer-only`,workspaceContextBudgets:Object.freeze({"workspace-skill":{min:400,max:1200},"onboard-context":{min:500,max:1200},"flow-context":{min:500,max:900}})});function c(e={}){let{audience:t=`agent`}=e,n=s,r=`## Layered Knowledge Protocol (v${n.version})
25
25
 
26
- AI Kit delivers knowledge through four layers:
26
+ AI Kit delivers knowledge through startup workspace context plus L1-L3:
27
27
 
28
- - **L0Generated Briefing Cards**: Fast, task-ready workspace setup. \`workspace-core\` available via \`status({ includePrelude: true })\` (compact summary), populated after \`onboard({ path, mode: 'generate' })\` runs for the workspace. Treat this card as already-loaded workspace context: consume it before broad \`search\`, \`scope_map\`, \`digest\`, or repeated \`file_summary\`. If workspaceCore null → run onboard first. If a flow is active, \`workflow:<flow>\` loaded via flow context (replaces task card). Total budget: ${n.sessionStart.totalTokenBudget} tokens.
28
+ - **Workspace Context Workspace Skill + Onboard Context**: Fast, task-ready workspace setup. \`status({ includePrelude: true })\` returns the workspace skill preview/resource pointer plus \`onboard_context\` (freshness verdict, package map, architecture pointers, project profile, read order). Treat fresh onboard context as already-loaded workspace context: read \`aikit://skill/SKILL.md\` when full repo-specific guidance is needed, and use onboard files before broad \`search\`, \`scope_map\`, \`digest\`, or repeated \`file_summary\`. If \`onboarded\` is false or \`onboard_context\` is null → run \`onboard({ path: ".", mode: "generate" })\` first, then status again. If \`onboard_context.freshness.status\` is \`stale\` or \`unknown\` run \`onboard({ path: ".", update: true })\`, then status again. Total budget: ${n.sessionStart.totalTokenBudget} tokens.
29
29
  - **L1 — Flow Working Context**: Active run state, current step, and role-filtered dispatch context. Withdraw via \`knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })\`.
30
30
  - **L2 — Canonical Curated Knowledge**: Durable workspace archive managed by CuratedKnowledgeManager. Retrieve on demand via \`search()\` or \`knowledge({ action: 'read' })\`.
31
31
  - **L3 — Evidence Archive**: Auto-knowledge observations and tool-output evidence. Inspect only for provenance, conflict review, or promotion assessment. Never auto-injected.
32
32
 
33
33
  ### Hot Path
34
- 1. Session start → run \`status({ includePrelude: true })\` to get compact workspace-core summary. Prerequisite: \`onboard({ path, mode: 'generate' })\` must have run for the workspace. If workspaceCore null → run onboard first, then status again.
35
- 2. Before broad repo scans, extract and reuse the L0 facts: workspace shape, package map, tool surfaces, key entry points, constraints, and known pitfalls. If L0 answers enough, skip \`scope_map\`/wide \`search\` and go straight to task-specific retrieval.
36
- 3. If flow active, \`workflow:<flow>\` loaded via flow context; use L1 snapshot + dispatch refs before broad retrieval. If no flow, may add one task card via \`file_summary\`.
34
+ 1. Session start → run \`status({ includePrelude: true })\` to get workspace skill + onboard context. Prerequisite: \`onboard({ path, mode: 'generate' })\` must have run for the workspace. If \`onboard_context\` is null → run onboard first, then status again. If freshness is \`stale\` or \`unknown\` → run \`onboard({ path: ".", update: true })\`, then status again.
35
+ 2. Before broad repo scans, extract and reuse fresh workspace skill/onboard facts: workspace shape, package map, architecture pointers, tool surfaces, key entry points, constraints, and known pitfalls. If this context answers enough, skip \`scope_map\`/wide \`search\` and go straight to task-specific retrieval.
36
+ 3. If flow active, use L1 snapshot + dispatch refs before broad retrieval. If no flow, may add one task card via \`file_summary\`.
37
37
  4. Retrieve L2 on demand.
38
38
  5. Inspect L3 only for evidence, provenance, or promotion.
39
39
 
40
40
  ### No-Flow Fallback
41
- - Keep L1 absent; workspace-core available via status after onboard; optionally one task card.
41
+ - Keep L1 absent; workspace skill + onboard context available via status after onboard; optionally one task card.
42
42
  - L2 on demand; turn-local scratch, no L1 synthesis.
43
43
 
44
44
  ### Degraded Fallback
45
- - Missing L0 card after regeneration → use \`status({ includePrelude: true })\` as compact fallback, then only task-specific L2 retrieval; do not replace L0 with a workspace-wide scan.
45
+ - Missing workspace skill/onboard context after regeneration → use \`status({ includePrelude: true })\` as compact fallback, then only task-specific L2 retrieval; do not replace the missing startup context with a workspace-wide scan.
46
46
  - Unavailable L1 → read persisted FlowRunMeta without mutation.
47
47
  - Unavailable indexed L2 → read canonical curated markdown directly.
48
48
  - Mark missing evidence unresolved; block promotion.
49
49
  `;return t===`skill`?r+`
50
50
  ### Skill Routing
51
- - Load L0 card families listed in \`LAYERED_KNOWLEDGE_OPERATING_POLICY.l0Budgets\`.
51
+ - Use \`status({ includePrelude: true })\` for workspace skill + onboard context; read \`aikit://skill/SKILL.md\` only when full guidance is needed.
52
52
  - Route L1 withdrawal by configured profile; never promote.
53
53
  - Emit L3 evidence as observer-only; never navigate flow state.`:t===`flow`?r+`
54
54
  ### Step Contracts
55
- Each built-in flow step declares knowledge inputs (L0 card types, L1 fields, L2 refs, L3 evidence), context updates, candidate learnings, and handoff artifacts. The step knowledge contract drives role-aware L1 projection.`:r}const l=r(`## Output Rules (HARD RULE)`,`**Plain text is allowed only when ALL are true:**`,` - Response is 1-2 short sentences.`,` - No table, list, checklist, plan, report, verdict, review, summary, progress, evidence map, or batch result is being returned.`,` - No user approval, mandatory stop, or choice is needed.`,"Follow the **Presentation Priority** (1st Inline Visual - `present({ schemaVersion: 1, title, blocks })` → 2nd Interactive - `present({ schemaVersion: 1, title, blocks, actions })` → 3rd Plain Text). Only tiny status/questions that pass the gate above → plain text (Priority 3). Prefer `present` for all others, especially summaries, comparisons, reports, task plans, verdicts, and progress.");function u(){return'## Tool Preference — AI Kit First (HARD RULE)\n\n**Never start with `read_file`, `grep_search`, `semantic_search`, or `run_in_terminal`. AI Kit tools replace all of these.**\n\n| Need | Use | NEVER |\n|------|-----|-------|\n| Structure of a file | `file_summary({ path })` | `read_file` to "understand" it |\n| Find specific code | `file_summary({ files, tier: \'T2\', query })` | `read_file` to search |\n| Multiple files | `digest({ sources, query })` | Multiple `read_file` calls |\n| Reuse previous output | `file_summary({ ref, query })` with `enrich:true` | Re-reading same file |\n| Search codebase | `search({ query })` | `grep_search` / `semantic_search` |\n| Find files by path/pattern | `find({ glob, pattern })` — returns paths + preview | `grep_search` / `ls` |\n| Find a symbol | `symbol({ name })` | `grep_search` |\n| Trace data flow | `trace({ items: [{start, direction}] })` | Manual code tracing |\n| Module relationships | `graph({action:\'neighbors\', node_id})` | Manual import tracing |\n| Typecheck + lint | `check({})` | `run_in_terminal tsc` / biome |\n| Run tests | `test_run({})` | `run_in_terminal vitest` |\n| Impact analysis | `blast_radius({ files })` — trace affected files from changes | Manual caller tracing |\n| Complexity metrics | `measure({ path })` | Line counting / wc |\n| L0 briefing card (workspace-core) | `status({ includePrelude: true })` (compact summary), `file_summary` | Raw file discovery |\n| L0 briefing card (known issues) | `search({ query: "known issues" })` + `knowledge({ action: "lesson" })` | Manual history review |\n| Web research | `web_search({ queries })` + `web_fetch({ urls })` | `fetch_webpage` |\n\n`read_file` is ONLY acceptable when you need exact line content FOR EDITING (before `replace_string_in_file`).\n\nEven then, use `file_summary` first to identify which lines to read.'}const d=r(`## AI Kit Tools`,"The AI Kit MCP server provides search, analysis, memory, validation, and coordination tools. Available tools vary by platform and version — run `list_tools` at session start to see the exact set on your platform. Tool names use short form (e.g. `search`, `file_summary`) in instructions; your runtime may prefix them (e.g. `mcp__aikit__search`).",``,"If AI Kit tools are unavailable or missing, run `npx -y @vpxa/aikit@latest init --user`, then reload the client."),f={"code-agent-base":`# Code Agent - Shared Kernel
55
+ Each built-in flow step declares workspace context inputs, L1 fields, L2 refs, L3 evidence, context updates, candidate learnings, and handoff artifacts. The step knowledge contract drives role-aware L1 projection.`:r}const l=r(`## Output Rules (HARD RULE)`,`**Plain text is allowed only when ALL are true:**`,` - Response is 1-2 short sentences.`,` - No table, list, checklist, plan, report, verdict, review, summary, progress, evidence map, or batch result is being returned.`,` - No user approval, mandatory stop, or choice is needed.`,"Follow the **Presentation Priority** (1st Inline Visual - `present({ schemaVersion: 1, title, blocks })` → 2nd Interactive - `present({ schemaVersion: 1, title, blocks, actions })` → 3rd Plain Text). Only tiny status/questions that pass the gate above → plain text (Priority 3). Prefer `present` for all others, especially summaries, comparisons, reports, task plans, verdicts, and progress.");function u(){return'## Tool Preference — AI Kit First (HARD RULE)\n\n**Never start with `read_file`, `grep_search`, `semantic_search`, or `run_in_terminal`. AI Kit tools replace all of these.**\n\n| Need | Use | NEVER |\n|------|-----|-------|\n| Structure of a file | `file_summary({ path })` | `read_file` to "understand" it |\n| Find specific code | `file_summary({ files, tier: \'T2\', query })` | `read_file` to search |\n| Multiple files | `digest({ sources, query })` | Multiple `read_file` calls |\n| Reuse previous output | `file_summary({ ref, query })` with `enrich:true` | Re-reading same file |\n| Search codebase | `search({ query })` | `grep_search` / `semantic_search` |\n| Find files by path/pattern | `find({ glob, pattern })` — returns paths + preview | `grep_search` / `ls` |\n| Find a symbol | `symbol({ name })` | `grep_search` |\n| Trace data flow | `trace({ items: [{start, direction}] })` | Manual code tracing |\n| Module relationships | `graph({action:\'neighbors\', node_id})` | Manual import tracing |\n| Typecheck + lint | `check({})` | `run_in_terminal tsc` / biome |\n| Run tests | `test_run({})` | `run_in_terminal vitest` |\n| Impact analysis | `blast_radius({ files })` — trace affected files from changes | Manual caller tracing |\n| Complexity metrics | `measure({ path })` | Line counting / wc |\n| Workspace skill + onboard context | `status({ includePrelude: true })`, `aikit://skill/SKILL.md` when full guidance is needed | Raw file discovery |\n| Known issues / recurring lessons | `search({ query: "known issues" })` + `knowledge({ action: "lesson" })` | Manual history review |\n| Web research | `web_search({ queries })` + `web_fetch({ urls })` | `fetch_webpage` |\n\n`read_file` is ONLY acceptable when you need exact line content FOR EDITING (before `replace_string_in_file`).\n\nEven then, use `file_summary` first to identify which lines to read.'}const d=r(`## AI Kit Tools`,"The AI Kit MCP server provides search, analysis, memory, validation, and coordination tools. Available tools vary by platform and version — run `list_tools` at session start to see the exact set on your platform. Tool names use short form (e.g. `search`, `file_summary`) in instructions; your runtime may prefix them (e.g. `mcp__aikit__search`).",``,"If AI Kit tools are unavailable or missing, run `npx -y @vpxa/aikit@latest init --user`, then reload the client."),f={"code-agent-base":`# Code Agent - Shared Kernel
56
56
 
57
57
  > Shared protocol for code-writing agents. Role files add only role-specific behavior.
58
58
 
@@ -1,111 +1,4 @@
1
- var e=[{file:`SKILL.md`,content:`---
2
- name: aikit
3
- description: "Use the @vpxa/aikit AI Kit MCP server for codebase search, context compression, validation, and persistent memory. Load at session start or before using aikit_* tools. This skill teaches tool judgment: minimize raw reads, choose the smallest useful retrieval path, and persist decisions that matter."
4
- metadata:
5
- category: cross-cutting
6
- domain: general
7
- applicability: always
8
- inputs: [codebase]
9
- outputs: [search-results, analysis, knowledge]
10
- relatedSkills: [session-handoff, present]
11
- ---
12
-
13
- # @vpxa/aikit - AI Kit
14
-
15
- Use AI Kit as compression, memory, validation, and coordination layer. Each call should reduce uncertainty or token load.
16
-
17
- ## Communicating With the User
18
-
19
- **Use \`present({ schemaVersion: 1, title, blocks })\` for ALL non-trivial output.** This is the preferred way to show summaries, results, evidence maps, task plans, reviews, comparisons, dashboards, charts, timelines, and batch results to the user. Plain text is only for 1-2 sentence status updates or simple questions. The \`present\` tool renders rich, structured output that the user can interact with.
20
-
21
- ## Session Loop
22
-
23
- Start:
24
- 1. status({ includePrelude: true }).
25
- 2. If prelude.workspaceCore is null → run \`onboard({ path, mode: 'generate' })\`, then \`status({ includePrelude: true })\` again.
26
- 3. **L0 session start**: Run \`status({ includePrelude: true })\` for compact workspace-core summary. Extract workspace shape, package map, tool surfaces, key entry points, constraints, and known pitfalls before broad retrieval. If L0 answers enough, skip \`scope_map\`/wide \`search\`. If a flow is active, workflow card loaded via flow context. ≤ 2,100 tokens.
27
- 4. search({ query: "SESSION CHECKPOINT", origin: "curated" }).
28
- 5. flow({ action: 'status' }) when active flow may exist — use L1 snapshot before broad retrieval.
29
- 6. scope_map({ task }) only when L0 + checkpoint do not identify a narrow workset.
30
-
31
- During:
32
- - Prefer search/file_summary/digest/symbol/trace/graph over raw reads.
33
- - Use stash for temporary findings; knowledge for durable decisions.
34
- - Run blast_radius before shared/public edits.
35
- - Validate with check + relevant test_run.
36
-
37
- End:
38
- - reindex after structural changes.
39
- - produce_knowledge for durable project updates.
40
- - session_digest({ persist: true }).
41
- - knowledge remember session checkpoint with done/decisions/next/blockers.
42
-
43
- ## Retrieval Ladder — Layered (L0-L3)
44
-
45
- > This table maps knowledge layers to tool needs. For the canonical quick-reference tool decision table, see \`aiKitToolPreference()\` in protocols.mjs.
46
-
47
- | Layer | Need | Tool |
48
- |-------|------|------|
49
- | **L0** | Session briefing (after onboard) | \`status({ includePrelude: true })\` (compact summary). Run \`onboard\` first if card missing. Consume before broad scans. |
50
- | **L0** | Architecture overview | \`architecture\` briefing card |
51
- | **L0** | Known issues | \`known-issues\` briefing card |
52
- | **L0** | Flow-specific context | \`workflow:<flow>\` briefing card |
53
- | **L1** | Active flow state | \`knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>' })\` |
54
- | **L2** | Prior decisions/conventions | \`search\` / \`knowledge\` |
55
- | **L2** | File structure | \`file_summary({ files, tier: 'T1' })\` |
56
- | **L2** | Exact relevant section | \`file_summary({ files, tier: 'T2' })\` |
57
- | **L2** | Many files | \`digest\` |
58
- | **L2** | Symbol defs/refs | \`symbol\` |
59
- | **L2** | Call/data flow | \`trace\` |
60
- | **L2** | Module/import relationships | \`graph\` |
61
- | **L2** | Impact | \`blast_radius\` |
62
- | **L2** | Type/lint/test | \`check\` / \`test_run\` |
63
- | **L3** | Evidence, provenance, conflict review | \`search\` with \`knowledge({ action: 'lesson' })\` — focused only |
64
- | **General** | Tool choice unknown | \`list_tools({ intent: "<task>" })\` (use intent param for planner-ranked results) or \`search({ query: "tool to <do X>" })\` |
65
-
66
- Raw read_file only for exact edit lines after compressed tools identify target.
67
-
68
- ## Context Reuse
69
-
70
- Before rereading path/topic, search exact path/topic first. If response gives ctxc_..., reuse with file_summary({ ref }) or file_summary({ ref, query }). Use enrich: true on tools that support it after first pass.
71
-
72
- ## Patterns
73
-
74
- - New area: search -> scope_map -> file_summary -> graph/trace -> stash.
75
- - Bug: search -> symbol -> trace -> file_summary -> test/check -> remember.
76
- - Refactor shared code: blast_radius -> checkpoint -> file_summary -> rename/codemod -> check -> test_run.
77
- - Web/API: web_search/web_fetch/http; browser only when JS/auth interaction needed. Browser snapshots now use ~200-400 tokens, making them practical for quick page state checks.
78
-
79
- ## Memory Discipline
80
-
81
- Store only high-signal facts:
82
- - Decisions and rationale.
83
- - Conventions that constrain future work.
84
- - Non-obvious root causes and fixes.
85
- - Checkpoints and blockers.
86
-
87
- Review decayed/stale entries periodically with knowledge({ action: 'flagged' }). Use lesson actions for reusable engineering lessons; load lesson-learned after implementation/review work.
88
-
89
- ## Flow + FORGE
90
-
91
- Flows guide multi-step work. Read active step before acting. FORGE handles tiering/evidence/gates; load references only when main skill is too thin.
92
-
93
- ### Layered Knowledge Protocol
94
- - **L0** → Generated briefing cards: load \`workspace-core\` at session start via \`status({ includePrelude: true })\` (compact summary). Requires \`onboard()\` first — if card null, run \`onboard\` before session start. Consume L0 as the default workspace map before \`search\`, \`scope_map\`, \`digest\`, or repeated \`file_summary\`; add \`workflow:<flow>\` if flow active, or one task card if no flow. Use \`file_summary({ tier: 'T1' })\` for structure, or \`file_summary({ tier: 'T2', query })\` for content only after L0 narrows the workset. Token-bounded.
95
- - **L1** → Flow working context. Withdraw before dispatch; reuse before broad retrieval.
96
- - **L2** → Canonical curated knowledge. Retrieve on demand; never preload broadly.
97
- - **L3** → Evidence/auto-knowledge. Inspect only for provenance, conflict, or promotion assessment.
98
-
99
- Reference docs:
100
- - references/coordination.md - queue, lanes, stash, checkpoints, signaling.
101
- - references/forge-protocol.md - tiering, evidence, gates.
102
- - references/search-patterns.md - search, trace, graph, compression recipes.
103
- - references/layered-knowledge-protocol.md - L0-L3 operating policy and hot path.
104
-
105
- ## Self-Dogfooding
106
-
107
- When developing AI Kit itself: regenerate scaffold output, run focused checks, rebuild, then reindex so future searches see new shape.
108
- `},{file:`references/coordination.md`,content:`# Coordination
1
+ var e=[{file:`SKILL.md`,content:"---\nname: aikit\ndescription: \"Use the @vpxa/aikit AI Kit MCP server for codebase search, context compression, validation, and persistent memory. Load at session start or before using aikit_* tools. This skill teaches tool judgment: minimize raw reads, choose the smallest useful retrieval path, and persist decisions that matter.\"\nmetadata:\n category: cross-cutting\n domain: general\n applicability: always\n inputs: [codebase]\n outputs: [search-results, analysis, knowledge]\n relatedSkills: [session-handoff, present]\n---\n\n# @vpxa/aikit - AI Kit\n\nUse AI Kit as compression, memory, validation, and coordination layer. Each call should reduce uncertainty or token load.\n\n## Communicating With the User\n\n**Use `present({ schemaVersion: 1, title, blocks })` for ALL non-trivial output.** This is the preferred way to show summaries, results, evidence maps, task plans, reviews, comparisons, dashboards, charts, timelines, and batch results to the user. Plain text is only for 1-2 sentence status updates or simple questions. The `present` tool renders rich, structured output that the user can interact with.\n\n## Session Loop\n\nStart:\n1. status({ includePrelude: true }).\n2. If `onboarded` is false or `prelude.onboardContext` / `structuredContent.onboard_context` is null → run `onboard({ path, mode: 'generate' })`, then `status({ includePrelude: true })` again.\n3. If `onboard_context.freshness.status` is `stale` or `unknown`, or `nextAction.kind === \"update_onboard\"` → run `onboard({ path, update: true })`, then `status({ includePrelude: true })` again.\n4. **Workspace context start**: Extract workspace skill + fresh onboard context from status: `workspace_skill.uri`, `prelude.workspaceSkillResource`, `onboard_context.freshness`, `onboard_context.packageMap`, `onboard_context.architecture`, and `onboard_context.recommendedReadOrder`. Read `aikit://skill/SKILL.md` when full repo-specific guidance is needed. Use fresh onboard context before broad retrieval. ≤ 2,100 tokens.\n5. search({ query: \"SESSION CHECKPOINT\", origin: \"curated\" }).\n6. flow({ action: 'status' }) when active flow may exist — use L1 snapshot before broad retrieval.\n7. scope_map({ task }) only when workspace context + checkpoint do not identify a narrow workset.\n\nDuring:\n- Prefer search/file_summary/digest/symbol/trace/graph over raw reads.\n- Use stash for temporary findings; knowledge for durable decisions.\n- Run blast_radius before shared/public edits.\n- Validate with check + relevant test_run.\n\nEnd:\n- reindex after structural changes.\n- produce_knowledge for durable project updates.\n- session_digest({ persist: true }).\n- knowledge remember session checkpoint with done/decisions/next/blockers.\n\n## Retrieval Ladder — Layered (Workspace Context + L1-L3)\n\n> This table maps knowledge layers to tool needs. For the canonical quick-reference tool decision table, see `aiKitToolPreference()` in protocols.mjs.\n\n| Layer | Need | Tool |\n|-------|------|------|\n| **Workspace Context** | Workspace skill + fresh onboard context | `status({ includePrelude: true })`; read `aikit://skill/SKILL.md` only when full guidance is needed. Run `onboard({ path, mode: 'generate' })` if `onboard_context` is missing; run `onboard({ path, update: true })` if `onboard_context.freshness.status` is `stale` or `unknown`. Consume fresh context before broad scans. |\n| **Workspace Context** | Architecture overview | `status({ includePrelude: true }).onboard_context.architecture`, then onboard `diagram.md` / `domains.md` when deeper detail is needed |\n| **Workspace Context** | Package map / repo shape | `status({ includePrelude: true }).onboard_context.packageMap`, then onboard `structure.md` / `dependencies.md` |\n| **Flow Context** | Flow-specific context | L1 flow snapshot via `knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>' })` |\n| **L1** | Active flow state | `knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>' })` |\n| **L2** | Prior decisions/conventions | `search` / `knowledge` |\n| **L2** | File structure | `file_summary({ files, tier: 'T1' })` |\n| **L2** | Exact relevant section | `file_summary({ files, tier: 'T2' })` |\n| **L2** | Many files | `digest` |\n| **L2** | Symbol defs/refs | `symbol` |\n| **L2** | Call/data flow | `trace` |\n| **L2** | Module/import relationships | `graph` |\n| **L2** | Impact | `blast_radius` |\n| **L2** | Type/lint/test | `check` / `test_run` |\n| **L3** | Evidence, provenance, conflict review | `search` with `knowledge({ action: 'lesson' })` — focused only |\n| **General** | Tool choice unknown | `list_tools({ intent: \"<task>\" })` (use intent param for planner-ranked results) or `search({ query: \"tool to <do X>\" })` |\n\nRaw read_file only for exact edit lines after compressed tools identify target.\n\n## Context Reuse\n\nBefore rereading path/topic, search exact path/topic first. If response gives ctxc_..., reuse with file_summary({ ref }) or file_summary({ ref, query }). Use enrich: true on tools that support it after first pass.\n\n## Patterns\n\n- New area: search -> scope_map -> file_summary -> graph/trace -> stash.\n- Bug: search -> symbol -> trace -> file_summary -> test/check -> remember.\n- Refactor shared code: blast_radius -> checkpoint -> file_summary -> rename/codemod -> check -> test_run.\n- Web/API: web_search/web_fetch/http; browser only when JS/auth interaction needed. Browser snapshots now use ~200-400 tokens, making them practical for quick page state checks.\n\n## Memory Discipline\n\nStore only high-signal facts:\n- Decisions and rationale.\n- Conventions that constrain future work.\n- Non-obvious root causes and fixes.\n- Checkpoints and blockers.\n\nReview decayed/stale entries periodically with knowledge({ action: 'flagged' }). Use lesson actions for reusable engineering lessons; load lesson-learned after implementation/review work.\n\n## Flow + FORGE\n\nFlows guide multi-step work. Read active step before acting. FORGE handles tiering/evidence/gates; load references only when main skill is too thin.\n\n### Layered Knowledge Protocol\n- **Workspace Context** → Workspace skill + fresh onboard context: load via `status({ includePrelude: true })`. Requires `onboard()` first — if `onboard_context` is null, run `onboard`; if `onboard_context.freshness.status` is `stale` or `unknown`, run `onboard({ path, update: true })`. Consume the workspace skill preview/resource pointer and fresh onboard package map/architecture/read-order before `search`, `scope_map`, `digest`, or repeated `file_summary`. Use `file_summary({ tier: 'T1' })` for structure, or `file_summary({ tier: 'T2', query })` for content only after status/onboard context narrows the workset. Token-bounded.\n- **L1** → Flow working context. Withdraw before dispatch; reuse before broad retrieval.\n- **L2** → Canonical curated knowledge. Retrieve on demand; never preload broadly.\n- **L3** → Evidence/auto-knowledge. Inspect only for provenance, conflict, or promotion assessment.\n\nReference docs:\n- references/coordination.md - queue, lanes, stash, checkpoints, signaling.\n- references/forge-protocol.md - tiering, evidence, gates.\n- references/search-patterns.md - search, trace, graph, compression recipes.\n- references/layered-knowledge-protocol.md - workspace context + L1-L3 operating policy and hot path.\n\n## Self-Dogfooding\n\nWhen developing AI Kit itself: regenerate scaffold output, run focused checks, rebuild, then reindex so future searches see new shape.\n"},{file:`references/coordination.md`,content:`# Coordination
109
2
 
110
3
  Use coordination tools when work is parallel, long-running, or easy to repeat incorrectly.
111
4
 
@@ -200,53 +93,4 @@ file_summary (T1=structure, T2=content) or digest (multi-file synthesis). Read_f
200
93
  ## Rule of Thumb
201
94
 
202
95
  If you are about to read raw code, ask whether the answer is really about structure, relevance, flow, or relationships. AI Kit has a smaller tool for each of those.
203
- `},{file:`references/layered-knowledge-protocol.md`,content:`# Layered Knowledge Protocol
204
-
205
- AI Kit delivers knowledge through four layers:
206
-
207
- ## L0 — Generated Briefing Cards
208
-
209
- Fast, compact task setup loaded at session start.
210
-
211
- - **Auto-injected**: \`workspace-core\` (800-1200 tokens) — available via \`status({ includePrelude: true })\` after \`onboard()\` generates the card. If null → run \`onboard({ path, mode: 'generate' })\` then retry status.
212
- - **If flow active**: Load \`workflow:<flow>\` (500-900 tokens) via flow start refs (replaces task card)
213
- - **If no flow**: Optionally load one task card via \`file_summary\`
214
- - **Budget**: ≤ 2,100 tokens total
215
- - **Storage**: Generated workspace cache (path from server config)
216
- - **Card families**: \`workspace-core\`, \`architecture\`, \`testing-release\`, \`known-issues\`, \`workflow:<flow>\`
217
- - Session-start budget: workspace-core (800-1200 tokens) + 1 additional card ≤ 2,100 tokens total
218
- - Generated cache, not canonical — rebuildable from L2 canonical sources
219
-
220
- ## L1 — Flow Working Context
221
-
222
- Active run state and role-filtered dispatch context.
223
-
224
- - Withdraw via \`knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })\`
225
- - Use withdrawn refs before calling \`file_summary\`, \`scope_map\`, \`blast_radius\`, or \`search\`
226
- - Each step has a declared \`contextProfile\` (implementer, reviewer, researcher, documenter, debugger)
227
-
228
- ## L2 — Canonical Curated Knowledge
229
-
230
- Durable workspace archive managed by CuratedKnowledgeManager.
231
-
232
- - Retrieve on demand via \`search()\` or \`knowledge({ action: 'read' })\`
233
- - Never preload broadly at session start when L1 refs are already supplied
234
- - Markdown is the canonical form; vector/FTS indexes are derived
235
-
236
- ## L3 — Evidence Archive
237
-
238
- High-volume observations, proofs, failures, and runtime traces.
239
-
240
- - Never auto-injected into session or step context
241
- - Inspect only for provenance verification, conflict review, or promotion assessment
242
- - Auto-knowledge extractors write to L3; they cannot navigate flow state or promote
243
-
244
- ## Retrieval Order
245
-
246
- 1. L0 (loaded cards at session start)
247
- 2. L1 (flow withdrawal when active)
248
- 3. L2 (on-demand canonical knowledge)
249
- 4. L3 (focused evidence retrieval only)
250
-
251
- No active flow → keep L1 absent; use L0 + on-demand L2; turn-local context only.
252
- `}];export{e as default};
96
+ `},{file:`references/layered-knowledge-protocol.md`,content:"# Layered Knowledge Protocol\n\nAI Kit delivers knowledge through startup workspace context plus L1-L3:\n\n## Workspace Context — Workspace Skill + Onboard Context\n\nFast, compact task setup loaded at session start.\n\n- **Auto-injected/discoverable**: `status({ includePrelude: true })` returns workspace skill preview/resource pointer and `onboard_context` after `onboard()` generates artifacts. If `onboard_context` is null → run `onboard({ path, mode: 'generate' })` then retry status. If `onboard_context.freshness.status` is `stale` or `unknown` → run `onboard({ path, update: true })` then retry status.\n- **Full workspace skill**: Read `aikit://skill/SKILL.md` only when full conventions, commands, or lessons are needed.\n- **Onboard files**: Use `onboard_context.recommendedReadOrder` and paths for `synthesis-guide.md`, `structure.md`, `dependencies.md`, `diagram.md`, `domains.md`, `entry-points.md`, and `code-map.md`.\n- **If flow active**: Load L1 via `knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>' })` and reuse supplied refs before broad retrieval.\n- **If no flow**: Optionally load one task card via `file_summary`\n- **Budget**: ≤ 2,100 tokens total\n- **Storage**: Workspace skill plus generated onboard artifacts under the status `onboardDir`\n- Generated workspace context, not canonical — rebuildable from L2 canonical sources and current repo analysis\n\n## L1 — Flow Working Context\n\nActive run state and role-filtered dispatch context.\n\n- Withdraw via `knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })`\n- Use withdrawn refs before calling `file_summary`, `scope_map`, `blast_radius`, or `search`\n- Each step has a declared `contextProfile` (implementer, reviewer, researcher, documenter, debugger)\n\n## L2 — Canonical Curated Knowledge\n\nDurable workspace archive managed by CuratedKnowledgeManager.\n\n- Retrieve on demand via `search()` or `knowledge({ action: 'read' })`\n- Never preload broadly at session start when L1 refs are already supplied\n- Markdown is the canonical form; vector/FTS indexes are derived\n\n## L3 — Evidence Archive\n\nHigh-volume observations, proofs, failures, and runtime traces.\n\n- Never auto-injected into session or step context\n- Inspect only for provenance verification, conflict review, or promotion assessment\n- Auto-knowledge extractors write to L3; they cannot navigate flow state or promote\n\n## Retrieval Order\n\n1. Workspace context (workspace skill + onboard context at session start)\n2. L1 (flow withdrawal when active)\n3. L2 (on-demand canonical knowledge)\n4. L3 (focused evidence retrieval only)\n\nNo active flow → keep L1 absent; use workspace context + on-demand L2; turn-local context only.\n"}];export{e as default};
@@ -141,15 +141,15 @@ Default: Context + Container. Add Component only for a complex container and a c
141
141
  2. Identify audience and decision the diagram supports.
142
142
  3. **Gather evidence with AI Kit - check onboard cache FIRST:**
143
143
  a. **Check onboard cache:**
144
- - Run status({ includePrelude: true }) - if workspaceCore shows onboard data available:
145
- - Read cache from ~/.aikit/workspaces/<hash>/onboard/:
144
+ - Run status({ includePrelude: true }) - if structuredContent.onboard_context is present and onboard_context.freshness.status == "fresh":
145
+ - Use onboard_context.recommendedReadOrder and read cache files from onboardDir:
146
146
  - structure.md - module tree, layers, directory shape
147
147
  - dependencies.md - internal/external dependency graph
148
+ - diagram.md / domains.md - architecture boundaries
148
149
  - symbols.md - exported symbols, type signatures
149
150
  - entry-points.md - API surface, CLI entry points
150
- - Freshness: cache fresh if status().onboarded == true and index recent.
151
- For finer control: compare git diff --stat pending change count.
152
- Default: <50 pending changes -> serve from cache | >=50 -> refresh.
151
+ - Freshness: trust status().onboard_context.freshness.status, not timestamps inferred by the model.
152
+ If freshness is stale/unknown, run onboard({ path: ".", update: true }) and status again before using onboard files.
153
153
  b. **Use cache data for C4:**
154
154
  - Extract layers from structure analysis (layer-detector classifications)
155
155
  - Extract modules/containers from directory tree
@@ -155,8 +155,9 @@ Detailed workflow for acquiring and documenting project knowledge into \`docs/ar
155
155
 
156
156
  ### Phase 1: Scan and Read Intent (IR-aware)
157
157
 
158
- Pre-flight — load L0 + L1 context:
158
+ Pre-flight — load workspace context + L1 context:
159
159
  - \`status({ includePrelude: true })\`
160
+ - If \`onboard_context\` is missing, run \`onboard({ path: ".", mode: "generate" })\`; if \`onboard_context.freshness.status\` is \`stale\` or \`unknown\`, run \`onboard({ path: ".", update: true })\`; then status again.
160
161
  - \`knowledge({ action: 'withdraw', scope: 'flow', profile: 'documenter', budget: 6000 })\`
161
162
 
162
163
  Then check \`docs/.docs-state.json\` (the Committed Docs IR):
@@ -789,7 +790,7 @@ Use this template for any generated section that includes factual claims:
789
790
 
790
791
  ### Update Mode Template (\`docs/.docs-state.json\`)
791
792
 
792
- Committed state file for incremental documentation updates. L0 regeneratable cache,
793
+ Committed state file for incremental documentation updates. Workspace-context regeneratable cache,
793
794
  committed to git so clones have warm cache.
794
795
 
795
796
  **Design: extends existing schema (backward compatible).** NO parallel \`_lastSynced\` block.
@@ -798,7 +799,7 @@ Adds \`signatureHash\`, \`contractHash\` (optional), and \`syncedAt\` to the exi
798
799
  \`\`\`json
799
800
  {
800
801
  "version": "1.1",
801
- "layer": "l0",
802
+ "layer": "workspace-context",
802
803
  "timestamp": "ISO-8601",
803
804
  "lastCommitSha": "git rev-parse HEAD of last documented commit",
804
805
 
@@ -1732,7 +1733,7 @@ Orchestrate phased documentation generation with document-type-specific outputs
1732
1733
 
1733
1734
  Before executing the generation pipeline, load available context from across the infrastructure:
1734
1735
 
1735
- - L0: \`status({ includePrelude: true })\` — workspace context (lessons, conventions)
1736
+ - Workspace context: \`status({ includePrelude: true })\` — workspace skill, onboard context, lessons, conventions
1736
1737
  - L1: \`knowledge({ action: 'withdraw', scope: 'flow', profile: 'documenter', budget: 6000 })\` — flow context
1737
1738
  - L2: \`search({ origin: 'curated' })\` + \`knowledge({ action: 'lesson', subAction: 'list-lessons' })\` — curated knowledge
1738
1739
  - L3: Evidence archive (provenance only, never auto-injected)
@@ -1741,8 +1742,9 @@ Before executing the generation pipeline, load available context from across the
1741
1742
 
1742
1743
  ### Phase 1 — Docs IR Producer (deterministic)
1743
1744
 
1744
- Pre-flight: load L0 + L1 context from infrastructure.
1745
- - \`status({ includePrelude: true })\` — L0 prelude
1745
+ Pre-flight: load workspace context + L1 context from infrastructure.
1746
+ - \`status({ includePrelude: true })\` — workspace skill + onboard context prelude
1747
+ - If \`onboard_context\` is missing, generate onboard. If \`onboard_context.freshness.status\` is \`stale\` or \`unknown\`, update onboard, then status again.
1746
1748
  - \`knowledge({ action: 'withdraw', scope: 'flow', profile: 'documenter', budget: 6000 })\` — L1 flow context
1747
1749
 
1748
1750
  Step 1: Check \`docs/.docs-state.json\` (the Committed Docs IR):
@@ -1810,7 +1812,7 @@ Step 2: Doc inventory (always runs, not cached):
1810
1812
  - \`blast_radius({ files: changedFiles })\` — stale doc detection
1811
1813
 
1812
1814
  The IR (\`docs/.docs-state.json\`) stores:
1813
- - \`version\` + \`layer: "l0"\` (regeneratable cache, not curated; committed to git)
1815
+ - \`version\` + \`layer: "workspace-context"\` (regeneratable cache, not curated; committed to git)
1814
1816
  - \`lastCommitSha\` (committed = warm clones, no cold starts)
1815
1817
  - \`onboardRef\` (pointer to onboard cache, NO duplicated analysis data)
1816
1818
  - \`sourceFiles\` (per-file contentHash, signatureHash, contractHash, syncedAt, changeClass)
@@ -3304,7 +3306,7 @@ Each doc type uses specific tools. Load the tools before generating.
3304
3306
  Documentation is the bridge between AI Kit's layered knowledge and human readers.
3305
3307
 
3306
3308
  \`\`\`
3307
- L0 (Briefing Cards) ─→ docs/ — Human-readable summaries of workspace state
3309
+ Workspace skill + onboard context ─→ docs/ — Human-readable summaries of workspace state
3308
3310
 
3309
3311
  L1 (Flow Context) ───→ docs/architecture/flows/ — Flow design decisions → durable docs
3310
3312
  │ │
@@ -3315,7 +3317,7 @@ L3 (Evidence Archive) ──→ docs/reference/ — Verified claims with tool re
3315
3317
 
3316
3318
  | Layer | Docs Role | Action |
3317
3319
  |---|---|---|
3318
- | L0 | Regenerate via briefing-card-compiler when topics change | Card invalidation trigger |
3320
+ | Workspace context | Regenerate via onboard/status/skill compiler when topics change | Onboard + workspace skill freshness trigger |
3319
3321
  | L1 | Withdraw flow context, extract decisions/artifacts → docs/ | \`knowledge({action:'withdraw',scope:'flow'})\` |
3320
3322
  | L2 | Candidate for promotion from verified docs | Consolidation adjudication |
3321
3323
  | L3 | Evidence chain for every doc claim | \`knowledge({action:'lesson'})\` + receipts |
@@ -3439,7 +3441,7 @@ Report: "No documentation updates needed" + brief reason.
3439
3441
  - If \`syncedAt\` missing on doc → treat as stale (conservative), emit warning
3440
3442
  - If no recent lessons match → continue silently
3441
3443
  - Session dedup: maintain \`Set<string>\` of checked topic+entry IDs per session; skip if already checked
3442
- 2. **Load layered context**: \`status({ includePrelude: true })\` → L0. \`knowledge({ action: 'withdraw', scope: 'flow', profile: 'documenter', budget: 6000 })\` → L1.
3444
+ 2. **Load layered context**: \`status({ includePrelude: true })\` → fresh workspace context (generate/update onboard first if missing/stale/unknown). \`knowledge({ action: 'withdraw', scope: 'flow', profile: 'documenter', budget: 6000 })\` → L1.
3443
3445
  3. Gather intent/evidence from flow artifacts, git diff, blast_radius, produce_knowledge, analyze, changelog, or search.
3444
3446
  4. Classify target docs with Diataxis or extended doc type table.
3445
3447
  5. Map changed capability to doc action.
@@ -467,8 +467,8 @@ Every subagent prompt includes:
467
467
  2. Goal + acceptance criteria.
468
468
  3. Files/boundary + do-not-touch list.
469
469
  4. Compressed context: relevant snippets, conventions, decisions, active flow paths.
470
- 5. **L0/L1 refs**: Include \`selectedCardRefs\`, \`retrievedRefs\`, and L1 \`FlowContextSnapshotV1\` fields relevant to the role.
471
- 6. **Hard rule — no broad card reload**: Subagent must reuse supplied refs first. Must NOT independently reload \`workspace-core\`, architecture, testing-release, or known-issues cards when the dispatch already carries applicable refs.
470
+ 5. **Workspace/L1 refs**: Include supplied workspace skill/onboard context, \`retrievedRefs\`, and L1 \`FlowContextSnapshotV1\` fields relevant to the role.
471
+ 6. **Hard rule — no broad rediscovery**: Subagent must reuse supplied refs first. Must NOT independently rediscover workspace basics or reload architecture context when the dispatch already carries applicable refs.
472
472
  7. Constraints: skills to load, libraries/patterns, no present, no flow advance.
473
473
  8. FORGE: tier, task_id, evidence claims to add.
474
474
  9. Validation: expected check, test_run, or reason skipped.
@@ -480,10 +480,10 @@ Use references/implementer-prompt.md for implementation dispatches and reference
480
480
 
481
481
  Before dispatch:
482
482
  - knowledge({ action: 'withdraw', scope: 'flow', profile: '<role>', budget: 6000 })
483
- - Include \`selectedCardRefs\` (L0 card refs) and \`retrievedRefs\` (from L1) in the dispatch envelope.
483
+ - Include supplied workspace/onboard context refs and \`retrievedRefs\` (from L1) in the dispatch envelope.
484
484
  - Add only missing snippets with file_summary/digest.
485
485
  - Paste context into dispatch; do not tell subagent to rediscover basics.
486
- - **Hard rule**: Subagent must reuse supplied L0/L1 refs before broad retrieval. Block if it reloads \`workspace-core\` or architecture cards independently.
486
+ - **Hard rule**: Subagent must reuse supplied workspace/L1 refs before broad retrieval. Block if it independently rediscovers workspace basics already present in the dispatch.
487
487
 
488
488
  After subagent work:
489
489
  - Store durable findings with knowledge({ action: 'remember', scope: 'flow', ... }).
@@ -27,14 +27,19 @@ YOU MUST FOLLOW THIS PROTOCOL ON EVERY TASK. You are an orchestrator, not an imp
27
27
 
28
28
  Execute these before ANY other work:
29
29
  1. \`flow({ action: 'status' })\` — Check active flow state.
30
- 2. \`status({ includePrelude: true })\` — Load L0 workspace context plus workspace skill summary.
31
- 3. If workspaceCore null → \`onboard({ path: "." })\` first, then status again.
32
- 4. \`skill({ name: 'aikit' })\` Load the AI Kit skill for tool routing, retrieval ladder, and communication patterns.
30
+ 2. \`status({ includePrelude: true })\` — Load workspace skill summary plus onboard context.
31
+ 3. If \`onboarded\` is false or \`onboard_context\` is null → \`onboard({ path: ".", mode: "generate" })\` first, then status again.
32
+ 4. If \`onboard_context.freshness.status\` is \`stale\` or \`unknown\`, or \`nextAction.kind === "update_onboard"\` \`onboard({ path: ".", update: true })\` first, then status again.
33
+ 5. \`skill({ name: 'aikit' })\` — Load the AI Kit skill for tool routing, retrieval ladder, and communication patterns.
33
34
 
34
35
  On platforms without native \`skill()\` support, the AI Kit instructions are already in your system prompt via other channels.
35
36
 
36
37
  **Workspace skill:** \`status({ includePrelude: true })\` gives you the compact summary. For full content (conventions, commands, lessons): read \`aikit://skill/SKILL.md\` MCP resource on demand.
37
38
 
39
+ ## User-Facing Presentation
40
+
41
+ Use \`present({ schemaVersion: 1, title, blocks })\` for almost every substantive response to the user. If the response is more than 3 sentences, contains a list/table/checklist/plan/status/verdict/summary/progress/evidence map, or asks for approval/choice, use \`present\`. Prefer \`present\` even without actions for read-only summaries; add \`actions\` for approvals, confirmations, and selections. Plain text only for tiny status updates or one simple question that fits in 3 short sentences.
42
+
38
43
  ## Delegation Rules
39
44
 
40
45
  **RULE 1 — Decompose everything.** Break every task into independent, parallelizable subtasks.