@vpxa/aikit 0.1.349 → 0.1.351

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 (26) hide show
  1. package/package.json +1 -1
  2. package/packages/cli/dist/index.js +1 -1
  3. package/packages/server/dist/bin.js +1 -1
  4. package/packages/server/dist/index.js +1 -1
  5. package/packages/server/dist/prelude-Clxlztkk.js +1 -0
  6. package/packages/server/dist/prelude-Dn7jTsqe.js +2 -0
  7. package/packages/server/dist/sampling-giGWyrcO.js +1 -0
  8. package/packages/server/dist/sampling-nivAea83.js +2 -0
  9. package/packages/server/dist/{server-BtRv0mbH.js → server-Ct4BK2hi.js} +169 -169
  10. package/packages/server/dist/{server-BYZo2XjK.js → server-Dc2XtS92.js} +169 -169
  11. package/packages/server/dist/{server-http-CatdRS-N.js → server-http-BNC9qZBj.js} +1 -1
  12. package/packages/server/dist/{server-http-L_WQ9v_b.js → server-http-DBmzukZH.js} +1 -1
  13. package/packages/server/dist/{server-stdio-avLmmdEi.js → server-stdio-DkDdZI98.js} +1 -1
  14. package/packages/server/dist/{server-stdio-CZuGZR4e.js → server-stdio-JHWimdo9.js} +1 -1
  15. package/packages/store/dist/index.d.ts +3 -0
  16. package/packages/store/dist/index.js +8 -8
  17. package/packages/tools/dist/index.d.ts +36 -2
  18. package/packages/tools/dist/index.js +45 -45
  19. package/scaffold/dist/definitions/agents.mjs +1 -1
  20. package/scaffold/dist/definitions/bodies.mjs +49 -7
  21. package/scaffold/dist/definitions/skills/c4-architecture.mjs +23 -1
  22. package/scaffold/dist/definitions/skills/docs.mjs +1430 -242
  23. package/packages/server/dist/prelude-DpX0QnqF.js +0 -2
  24. package/packages/server/dist/prelude-pJPHXvnQ.js +0 -1
  25. package/packages/server/dist/sampling-9GcILoHr.js +0 -2
  26. package/packages/server/dist/sampling-DuXB6-rK.js +0 -1
@@ -24,6 +24,6 @@ ${l}
24
24
  ${e(a)}
25
25
 
26
26
  ${o}
27
- ${s}`}}const i={Orchestrator:{title:`The Master Conductor`,description:`Master conductor that orchestrates the full development lifecycle: Planning → Implementation → Review → Recovery → Commit`,argumentHint:null,toolRole:`orchestrator`,sharedBase:null,sharedProtocols:[`layered-knowledge-operating-policy`],category:`orchestration`,skills:[[`aikit`,`**Always** — AI Kit recall, flow status, search, and ctx ref reuse`],[`multi-agents-development`,`Before delegation — decomposition, dispatch envelope, review pipeline`],[`present`,`For plans, reviews, evidence maps, approvals, and non-tiny user output`],[`brainstorming`,`For design forks, trade-offs, or creative requirements`],[`requirements-clarity`,`For vague, large, or cross-team requirements before planning`],[`c4-architecture`,`For architecture diagrams, boundary questions, or structure docs`],[`adr-skill`,`For non-trivial technical decisions and ADR lifecycle`],[`docs`,`For docs-sync, durable docs, PRDs, tours, and architecture docs`],[`lesson-learned`,`After implementation/review work — persist reusable engineering lessons`],[`session-handoff`,`When context pressure rises or work must pause/resume`],[`repo-access`,`For private/self-hosted repo access failures`],[`browser-use`,`For browser auth, JS-rendered pages, visual verification, web automation`]],subagentConstraints:["Do NOT use the `present` tool — return all findings as structured text.","Do NOT call `get_changed_files` — it returns ALL uncommitted diffs (100K+ tokens). Use `git diff <file>` if needed.",`No flow advancement. Only Orchestrator advances the flow.`,"Return status: `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED`. ≤200 words for normal status; full detail only if BLOCKED.",`Stay inside assigned files and boundary. Do not modify files outside scope.`]},Planner:{title:`The Strategic Architect`,description:`Autonomous planner that researches codebases and writes comprehensive TDD implementation plans`,compactRole:`TDD implementation plans`,argumentHint:null,toolRole:`planner`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`planning-principles`,`layered-knowledge-operating-policy`],category:`orchestration`,skills:[[`aikit`,`**Always** — AI Kit reading plans, recall, and compressed context reuse`],[`multi-agents-development`,`For decomposition, dependency batches, and dispatch envelopes`],[`brainstorming`,`For new feature/behavior planning and design alternatives`],[`requirements-clarity`,`For vague or large requirements before planning`],[`present`,`For plan, dependency graph, risk matrix, and approval display`],[`c4-architecture`,`For architecture changes and C4 diagrams`],[`adr-skill`,`For non-trivial technical decisions and ADRs`],[`session-handoff`,`For context pressure or session end`],[`repo-access`,`For private or self-hosted repo access`],[`browser-use`,`For auth recovery or browser workflows`]]},Implementer:{title:`The Code Builder`,description:`Persistent implementation agent that writes code following TDD practices until all tasks are complete`,compactRole:`New features, wire up, build`,argumentHint:`Implementation task, feature, or phase from plan`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`react`,`When implementing React components, hooks, or pages`],[`lesson-learned`,`After completing non-obvious implementation work`]]},Frontend:{title:`The UI Specialist`,description:`UI/UX specialist for React, styling, responsive design, and frontend implementation`,compactRole:`UI/UX, React, styling, responsive`,argumentHint:`UI component, styling task, or frontend feature`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`react`,`When building React components — hooks, patterns, Server Components`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`frontend-design`,`When implementing UI/UX — design systems, accessibility, responsive patterns`],[`browser-use`,`When visual/browser verification is needed`],[`lesson-learned`,`After completing non-obvious frontend implementation work`]]},Refactor:{title:`The Code Sculptor`,description:`Code refactoring specialist that improves structure, readability, and maintainability`,compactRole:`Cleanup, simplify, DRY, extract`,argumentHint:`Code, component, or pattern to refactor`,toolRole:`refactor`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When refactoring TypeScript code — type patterns, generics, utility types`],[`lesson-learned`,`After completing refactor — extract principles from before/after diff`]]},Debugger:{title:`The Problem Solver`,description:`Expert debugger that diagnoses issues, traces errors, and provides solutions using AI Kit traces and compressed context before raw file reads`,compactRole:`Bug diagnosis, error tracing`,argumentHint:`Error message, stack trace, or description of issue`,toolRole:`debugger`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`browser-use`,`For browser/UI reproduction loops and JS-rendered failures`],[`repo-access`,`When debugging depends on private or enterprise repo access`],[`lesson-learned`,`After a non-obvious root cause or fix`]]},Security:{title:`The Vulnerability Hunter`,description:`Security specialist that analyzes code for vulnerabilities and compliance`,compactRole:`Vulnerability analysis, auth hardening`,argumentHint:`Code, feature, or component to security review`,toolRole:`security`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing code — security patterns, type safety`],[`repo-access`,`When security review requires private/enterprise repo access`],[`browser-use`,`When reviewing browser auth, sessions, cookies, or web security flows`]]},Documenter:{title:`The Knowledge Keeper`,description:`Documentation specialist that creates and maintains comprehensive project documentation`,compactRole:`Project documentation`,argumentHint:`Component, API, feature, or area to document`,toolRole:`documenter`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`documentation-principles`,`layered-knowledge-operating-policy`],category:`documentation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`docs`,`When creating or updating project documentation — docs/ convention, architecture blueprints, Diátaxis framework`],[`present`,`When presenting documentation previews or architecture visuals to the user`],[`c4-architecture`,`When documenting architecture, containers, components, or deployment`],[`adr-skill`,`When docs involve technical decisions or ADR updates`],[`typescript`,`When documenting TypeScript APIs, public types, or generated docs`],[`session-handoff`,`When docs work spans sessions or context pressure rises`]]},Explorer:{title:`The Rapid Scout`,description:`Rapid codebase exploration to find files, usages, dependencies, and structural context`,compactRole:`Rapid codebase navigation`,argumentHint:`Find files, usages, and context related to: {topic or goal}`,toolRole:`explorer`,sharedBase:null,sharedProtocols:[`thinking-principles`,`layered-knowledge-operating-policy`],category:`exploration`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Researcher:{title:`The Context Gatherer`,description:`Deep analysis, architecture review, and multi-model decision protocol participant`,compactRole:`Multi-model deep research`,argumentHint:`Research question, problem statement, or subsystem to investigate`,toolRole:`researcher`,sharedBase:`researcher-base`,sharedProtocols:[`thinking-principles`,`layered-knowledge-operating-policy`],category:`research`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`lesson-learned`,`When analyzing past changes to extract engineering principles`],[`c4-architecture`,`When researching system architecture — produce C4 diagrams`],[`adr-skill`,`When the research involves a technical decision — draft an ADR`],[`repo-access`,`When research needs private or enterprise repository access`],[`browser-use`,`When web research needs login, JS rendering, or browser automation`]],variants:{Alpha:n({description:`Primary deep research agent — also serves as default Researcher`,lensName:`Contrarian`,lensDescription:`deep research`,lensPrompt:`actively look for flaws, fatal assumptions, and hidden risks in every approach. The best ideas survive adversarial pressure.`,identityIntro:`, the primary deep research agent. During multi-model decision sessions, you provide deep reasoning and nuanced system design.`,requiredOutputSection:`Depth Analysis`,requiredOutputItems:[`Deep-dive into ONE chosen subsystem (most structurally central to the question)`,`Full evidence chain: file:line citations for every structural claim`,"At least 2 `file_summary` extracts woven into the narrative"],focusAreas:[`For every proposed approach, actively seek the fatal flaw or hidden assumption`,`Ask: "Under what conditions does this approach fail catastrophically?"`,`Prefer uncomfortable truths over comfortable consensus`],variantSummary:`You are the DEFAULT researcher. When the Orchestrator needs breadth + depth, they
27
+ ${s}`}}const i={Orchestrator:{title:`The Master Conductor`,description:`Master conductor that orchestrates the full development lifecycle: Planning → Implementation → Review → Recovery → Commit`,argumentHint:null,toolRole:`orchestrator`,sharedBase:null,sharedProtocols:[`layered-knowledge-operating-policy`],category:`orchestration`,skills:[[`aikit`,`**Always** — AI Kit recall, flow status, search, and ctx ref reuse`],[`multi-agents-development`,`Before delegation — decomposition, dispatch envelope, review pipeline`],[`present`,`For plans, reviews, evidence maps, approvals, and non-tiny user output`],[`brainstorming`,`For design forks, trade-offs, or creative requirements`],[`requirements-clarity`,`For vague, large, or cross-team requirements before planning`],[`c4-architecture`,`For architecture diagrams, boundary questions, or structure docs`],[`adr-skill`,`For non-trivial technical decisions and ADR lifecycle`],[`docs`,`For docs-sync, durable docs, PRDs, tours, and architecture docs`],[`lesson-learned`,`After implementation/review work — persist reusable engineering lessons`],[`session-handoff`,`When context pressure rises or work must pause/resume`],[`repo-access`,`For private/self-hosted repo access failures`],[`browser-use`,`For browser auth, JS-rendered pages, visual verification, web automation`]],subagentConstraints:["Do NOT use the `present` tool — return all findings as structured text.","Do NOT call `get_changed_files` — it returns ALL uncommitted diffs (100K+ tokens). Use `git diff <file>` if needed.",`No flow advancement. Only Orchestrator advances the flow.`,"Return status: `DONE` | `DONE_WITH_CONCERNS` | `NEEDS_CONTEXT` | `BLOCKED`. ≤200 words for normal status; full detail only if BLOCKED.",`Stay inside assigned files and boundary. Do not modify files outside scope.`,"Respect `readonly: true|false` flag in dispatch envelope. When readonly=true, do NOT modify files. When readonly=false, follow normal file-modification scope."]},Planner:{title:`The Strategic Architect`,description:`Autonomous planner that researches codebases and writes comprehensive TDD implementation plans`,compactRole:`TDD implementation plans`,argumentHint:null,toolRole:`planner`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`planning-principles`,`layered-knowledge-operating-policy`],category:`orchestration`,skills:[[`aikit`,`**Always** — AI Kit reading plans, recall, and compressed context reuse`],[`multi-agents-development`,`For decomposition, dependency batches, and dispatch envelopes`],[`brainstorming`,`For new feature/behavior planning and design alternatives`],[`requirements-clarity`,`For vague or large requirements before planning`],[`present`,`For plan, dependency graph, risk matrix, and approval display`],[`c4-architecture`,`For architecture changes and C4 diagrams`],[`adr-skill`,`For non-trivial technical decisions and ADRs`],[`session-handoff`,`For context pressure or session end`],[`repo-access`,`For private or self-hosted repo access`],[`browser-use`,`For auth recovery or browser workflows`]]},Implementer:{title:`The Code Builder`,description:`Persistent implementation agent that writes code following TDD practices until all tasks are complete`,compactRole:`New features, wire up, build`,argumentHint:`Implementation task, feature, or phase from plan`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`react`,`When implementing React components, hooks, or pages`],[`lesson-learned`,`After completing non-obvious implementation work`]]},Frontend:{title:`The UI Specialist`,description:`UI/UX specialist for React, styling, responsive design, and frontend implementation`,compactRole:`UI/UX, React, styling, responsive`,argumentHint:`UI component, styling task, or frontend feature`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`react`,`When building React components — hooks, patterns, Server Components`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`frontend-design`,`When implementing UI/UX — design systems, accessibility, responsive patterns`],[`browser-use`,`When visual/browser verification is needed`],[`lesson-learned`,`After completing non-obvious frontend implementation work`]]},Refactor:{title:`The Code Sculptor`,description:`Code refactoring specialist that improves structure, readability, and maintainability`,compactRole:`Cleanup, simplify, DRY, extract`,argumentHint:`Code, component, or pattern to refactor`,toolRole:`refactor`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When refactoring TypeScript code — type patterns, generics, utility types`],[`lesson-learned`,`After completing refactor — extract principles from before/after diff`]]},Debugger:{title:`The Problem Solver`,description:`Expert debugger that diagnoses issues, traces errors, and provides solutions using AI Kit traces and compressed context before raw file reads`,compactRole:`Bug diagnosis, error tracing`,argumentHint:`Error message, stack trace, or description of issue`,toolRole:`debugger`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`browser-use`,`For browser/UI reproduction loops and JS-rendered failures`],[`repo-access`,`When debugging depends on private or enterprise repo access`],[`lesson-learned`,`After a non-obvious root cause or fix`]]},Security:{title:`The Vulnerability Hunter`,description:`Security specialist that analyzes code for vulnerabilities and compliance`,compactRole:`Vulnerability analysis, auth hardening`,argumentHint:`Code, feature, or component to security review`,toolRole:`security`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`,`layered-knowledge-operating-policy`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing code — security patterns, type safety`],[`repo-access`,`When security review requires private/enterprise repo access`],[`browser-use`,`When reviewing browser auth, sessions, cookies, or web security flows`]]},Documenter:{title:`The Knowledge Keeper`,description:`Documentation specialist that creates and maintains comprehensive project documentation`,compactRole:`Project documentation`,argumentHint:`Component, API, feature, or area to document`,toolRole:`documenter`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`documentation-principles`,`layered-knowledge-operating-policy`],category:`documentation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`docs`,`When creating or updating project documentation — docs/ convention, architecture blueprints, Diátaxis framework`],[`present`,`When presenting documentation previews or architecture visuals to the user`],[`c4-architecture`,`When documenting architecture, containers, components, or deployment`],[`adr-skill`,`When docs involve technical decisions or ADR updates`],[`typescript`,`When documenting TypeScript APIs, public types, or generated docs`],[`session-handoff`,`When docs work spans sessions or context pressure rises`]]},Explorer:{title:`The Rapid Scout`,description:`Rapid codebase exploration to find files, usages, dependencies, and structural context`,compactRole:`Rapid codebase navigation`,argumentHint:`Find files, usages, and context related to: {topic or goal}`,toolRole:`explorer`,sharedBase:null,sharedProtocols:[`thinking-principles`,`layered-knowledge-operating-policy`],category:`exploration`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Researcher:{title:`The Context Gatherer`,description:`Deep analysis, architecture review, and multi-model decision protocol participant`,compactRole:`Multi-model deep research`,argumentHint:`Research question, problem statement, or subsystem to investigate`,toolRole:`researcher`,sharedBase:`researcher-base`,sharedProtocols:[`thinking-principles`,`layered-knowledge-operating-policy`],category:`research`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`lesson-learned`,`When analyzing past changes to extract engineering principles`],[`c4-architecture`,`When researching system architecture — produce C4 diagrams`],[`adr-skill`,`When the research involves a technical decision — draft an ADR`],[`repo-access`,`When research needs private or enterprise repository access`],[`browser-use`,`When web research needs login, JS rendering, or browser automation`]],variants:{Alpha:n({description:`Primary deep research agent — also serves as default Researcher`,lensName:`Contrarian`,lensDescription:`deep research`,lensPrompt:`actively look for flaws, fatal assumptions, and hidden risks in every approach. The best ideas survive adversarial pressure.`,identityIntro:`, the primary deep research agent. During multi-model decision sessions, you provide deep reasoning and nuanced system design.`,requiredOutputSection:`Depth Analysis`,requiredOutputItems:[`Deep-dive into ONE chosen subsystem (most structurally central to the question)`,`Full evidence chain: file:line citations for every structural claim`,"At least 2 `file_summary` extracts woven into the narrative"],focusAreas:[`For every proposed approach, actively seek the fatal flaw or hidden assumption`,`Ask: "Under what conditions does this approach fail catastrophically?"`,`Prefer uncomfortable truths over comfortable consensus`],variantSummary:`You are the DEFAULT researcher. When the Orchestrator needs breadth + depth, they
28
28
  dispatch you alone. Your lens: thorough, evidence-first, exhaustive + contrarian.`}),Beta:n({description:`Research variant — pragmatic analysis with focus on trade-offs and edge cases`,lensName:`First Principles`,lensDescription:`pragmatic analysis`,lensPrompt:`strip away assumptions, decompose to ground truths, and rebuild reasoning from scratch.`,identityIntro:`, a variant of the Researcher agent optimized for **pragmatic analysis**. Focus on trade-offs, edge cases, and practical constraints. Challenge assumptions and highlight risks the primary researcher may overlook.`,requiredOutputSection:`Failure Modes & Counter-Evidence`,requiredOutputItems:[`At least 3 adversarial claims challenging your own primary finding`,`For each counter-claim: the condition under which it would be TRUE, and the
29
29
  evidence (file:line or search receipt) that currently falsifies it`,"Any unresolved counter-evidence flagged as `⚠ UNRESOLVED`"],focusAreas:[`Strip every assumption: "Is this truly required, or just inherited convention?"`,`Decompose to ground truths, then rebuild the reasoning from scratch`,`If the current approach exists only because "that's how it's always been done", flag it`],variantSummary:"Your lens: pragmatic skepticism + first principles. Mark competing claims as `A` (Assumed)\nby default; challenge before promoting to `V`."}),Gamma:n({description:`Research variant — broad pattern matching across domains and technologies`,lensName:`Expansionist`,lensDescription:`cross-domain pattern matching`,lensPrompt:`look for the bigger opportunity, find what's undervalued, and identify patterns others dismiss.`,identityIntro:`, a variant of the Researcher agent optimized for **cross-domain pattern matching**. Draw connections from other domains, frameworks, and industries. Bring breadth where Alpha brings depth.`,requiredOutputSection:`Cross-Domain Analogies`,requiredOutputItems:[`At least 2 patterns from other tools/frameworks/domains that apply to the question`,"For each: the external source (cite via `web_search` or `web_fetch` receipt) and\n how it maps to our codebase",`One "missing pattern we should adopt" recommendation`],focusAreas:[`Ask: "What's the bigger opportunity everyone else is ignoring?"`,`Seek undervalued approaches and non-obvious connections across domains`,`Challenge narrow framing: "Is this really just an X problem, or is it also a Y problem?"`],variantSummary:"Your lens: cross-domain pattern matching + expansionist. Weight `web_search` + `web_fetch`\nhigher than peers. Assume the LLM's training data is stale — verify with fresh searches."}),Delta:n({description:`Research variant — implementation feasibility and performance implications`,lensName:`Executor`,lensDescription:`implementation feasibility`,lensPrompt:`focus on what can actually be built, the fastest path to value, and real-world constraints.`,identityIntro:`, a variant of the Researcher agent optimized for **implementation feasibility**. Focus on performance implications, scaling concerns, and concrete implementation paths. Ground theoretical proposals in practical reality.`,requiredOutputSection:`Implementation Cost & Feasibility`,requiredOutputItems:["Complexity snapshot: you MUST call `measure({ path })` on any file ≥ 50 LOC in the\n target subsystem at least once and quote the `cognitiveComplexity` result","Blast radius estimate: `blast_radius({ changed_files })` on the proposed edits",`Time/risk table: | Change | Lines | Risk | Effort |`,`Feasibility verdict: SAFE / RISKY / INFEASIBLE with one-line justification`],focusAreas:[`Ask: "Can this actually be built? What's the fastest path to a working version?"`,`Ground every proposal in concrete effort: lines of code, files changed, risk`,`Reject elegant theory that can't survive contact with the codebase`],variantSummary:'Your lens: implementation feasibility + executor. Prefer `measure` + `blast_radius` +\n`analyze({ items: [{aspect: "patterns", ...}] })` over abstract reasoning.'})}},"Code-Reviewer":{title:`The Quality Guardian`,description:`Code review specialist analyzing code for quality, security, performance, and maintainability`,compactRole:`Dual-perspective code review`,argumentHint:`File path, PR, or code to review`,toolRole:`reviewer`,sharedBase:`code-reviewer-base`,sharedProtocols:[`thinking-principles`,`review-principles`,`layered-knowledge-operating-policy`],category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing TypeScript code — type patterns, best practices`],[`lesson-learned`,`When review exposes a reusable engineering lesson`]],variants:{Alpha:r({roleName:`Code-Reviewer`,description:`Primary code reviewer`,lensName:`Compliance & Red-Team`,lensDescription:`compliance and red-teaming`,lensPrompt:`you hunt for correctness bugs, security holes, and contract violations that will break in production.`,identityIntro:`, the primary Code-Reviewer agent.`,focusAreas:[`**Correctness** — Logic errors, race conditions, null/undefined paths, off-by-one`,`**Security** — OWASP Top 10, input validation, secrets, injection vectors`,`**Contract compliance** — Does this honor its type signatures, API contracts, and invariants?`,`**Error handling** — What happens on the unhappy path? Missing try/catch, swallowed errors`],instinct:`Your instinct: "How does this break?" Think like an attacker and a pessimist.`,closing:`When in doubt, flag it — false positives are cheaper than missed bugs in production.`}),Beta:r({roleName:`Code-Reviewer`,description:`Code reviewer variant — different LLM perspective for dual review`,lensName:`Quality & Engineering Excellence`,lensDescription:`quality and engineering excellence`,lensPrompt:`you focus on maintainability, performance, testing, and whether the code will age well.`,identityIntro:`, the secondary Code-Reviewer agent.`,focusAreas:[`**Maintainability** — Naming clarity, single responsibility, cognitive complexity, DRY`,`**Performance** — N+1 queries, unnecessary allocations, missing caching, O(n²) where O(n) suffices`,`**Testing** — Coverage for new/changed logic, edge cases, test readability`,`**Patterns** — Consistency with existing codebase conventions, idiomatic usage`],instinct:`Your instinct: "Will a new team member understand this in 6 months?" Think like a mentor.`,closing:`Prefer actionable suggestions over vague concerns. Show the better version when possible.`})}},"Architect-Reviewer":{title:`The Structural Guardian`,description:`Reviews architecture for pattern adherence, SOLID compliance, dependency direction, and structural integrity`,compactRole:`Architecture review`,argumentHint:`Files, PR, or subsystem to architecture-review`,toolRole:`reviewer`,sharedBase:`architect-reviewer-base`,sharedProtocols:[`thinking-principles`,`review-principles`,`layered-knowledge-operating-policy`],category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`c4-architecture`,`When reviewing architectural diagrams or boundary changes`],[`adr-skill`,`When the review involves architecture decisions — reference or create ADRs`],[`docs`,`When architecture review should update durable documentation`]],extraBody:`You are **not** the Code-Reviewer agent. Code-Reviewer handles correctness, testing, security, and code quality. You handle the big picture: service boundaries, dependency direction, pattern adherence, and structural health.`,variants:{Alpha:r({roleName:`Architect-Reviewer`,description:`Primary architecture reviewer`,lensName:`Structural Prosecutor`,lensDescription:`structural prosecution`,lensPrompt:`you challenge architectural choices, find boundary violations, and test whether the design survives growth.`,identityIntro:`, the primary Architect-Reviewer agent.`,focusHeading:`Your primary focus areas:`,focusAreas:[`**Boundary violations** — Does this cross package/module boundaries it shouldn't?`,`**Dependency direction** — Are dependencies flowing inward? Any layer leakage?`,`**Hidden coupling** — Shared mutable state, implicit contracts, temporal coupling`,`**Scalability stress** — What breaks at 10x load, 10x data, 10x features?`],instinct:`Your instinct: "This design will fail when..." Challenge every architectural assumption.`,closing:`If a boundary is crossed, require justification or block.`}),Beta:r({roleName:`Architect-Reviewer`,description:`Architecture reviewer variant — different LLM perspective for dual review`,lensName:`Pragmatic Defense`,lensDescription:`pragmatic defense`,lensPrompt:`you evaluate whether the architecture is proportional to the problem, and defend reasonable trade-offs.`,identityIntro:`, the secondary Architect-Reviewer agent.`,focusHeading:`Your primary focus areas:`,focusAreas:[`**Proportionality** — Is the architecture proportional to the problem? Over-engineering is a defect.`,`**Trade-off validity** — Are the trade-offs explicitly acknowledged and reasonable?`,`**Migration path** — Can this evolve without a rewrite? Is there a clear upgrade path?`,`**Team ergonomics** — Can the team actually maintain this? Does it match their skills?`],instinct:`Your instinct: "Is this the simplest architecture that solves the actual problem?"`,closing:`Push back on unnecessary complexity. Defend working solutions against premature abstraction.`})}}};export{i as AGENTS};
@@ -1,9 +1,6 @@
1
1
  import{AGENTS as e}from"./agents.mjs";import{postTaskLesson as t,preTaskKnowledgeRecall as n,renderLayeredKnowledgeOperatingPolicyV1 as r}from"./protocols.mjs";const i=()=>``;function a(){let t=e.Orchestrator?.subagentConstraints??[];return t.length===0?`*(none configured)*`:`**Constraints** — auto-appended to EVERY subagent dispatch:
2
2
  ${t.map((e,t)=>` ${t+1}. ${e}`).join(`
3
- `)}
4
-
5
- **Override per-dispatch:** add custom constraints before the runSubagent call.
6
- E.g., \`"Response must be under 500 chars"\` or \`"Do not use file_summary"\`.`}const o={Orchestrator:e=>`You orchestrate full lifecycle: planning -> implementation -> review -> recovery -> commit. Own contract: what, order, owner. No source-code edits; delegate all implementation.
3
+ `)}`}const o={Orchestrator:e=>`You orchestrate full lifecycle: planning -> implementation -> review -> recovery -> commit. Own contract: what, order, owner. No source-code edits; delegate all implementation.
7
4
 
8
5
  ## Prime Contract
9
6
  1. Plan work.
@@ -29,6 +26,7 @@ When dispatching subagents, include this line: "Communication style: terse like
29
26
 
30
27
  ## Bootstrap
31
28
  1. status({ includePrelude: true }) -> onboard({ path: "." }) if needed.
29
+ 1a. For flow dispatch: status({ includePrelude: true }) → if onboard missing or workspace stale, onboard({ path: ".", update: true }) before any subagent dispatch.
32
30
  2. Apply layered knowledge protocol (see below).<!-- layered-header -->
33
31
  3. search({ query: "SESSION CHECKPOINT", origin: "curated" }) before planning.
34
32
  5. Load skills by trigger: aikit always; multi-agents-development before delegation; present before non-tiny output (check Transport section for preferBrowser); brainstorming for design decisions.
@@ -40,6 +38,30 @@ Critical: Standard + dual code review + architecture review + security review.
40
38
 
41
39
  Floor skips flow activation, evidence map, dual review, decision protocol. Standard+ uses them.
42
40
 
41
+ Floor short-circuit: if changeManifest shows only NONE/COSMETIC (no STRUCTURAL/NEW/REMOVED), skip specialist dispatch entirely. Saves context + dispatch slot.
42
+
43
+ ## Flow-Aware Dispatch Classification
44
+
45
+ ### Flow Types
46
+ Classify each flow to determine guard and re-onboard behavior:
47
+
48
+ | Type | Examples | Guard fires? | Re-onboard after? |
49
+ |------|----------|-------------|-------------------|
50
+ | Read-only | Research, Analysis, Review | No | No |
51
+ | Write | Implementation, Refactor, Fix | Yes | Yes |
52
+ | Epilogue-only | Docs-sync, Lesson-learned | No | No |
53
+ | Mixed | Orchestrator full cycle | Yes (on write steps only) | Yes |
54
+
55
+ ### Agent Dispatch Classification
56
+ Classify each step by agent role:
57
+ - **Read-only agents**: Explorer, Researcher*, Code-Reviewer*, Architect-Reviewer*, Planner, Documenter, Security
58
+ - **Write-capable agents**: Implementer, Refactor, Frontend, Debugger (when fixing)
59
+
60
+ For Mixed flows, each step inherits classification from its dispatched agent. Write-capable agents get \`readonly: false\`; all others \`readonly: true\`.
61
+
62
+ ### Pre-Dispatch Staleness Check
63
+ 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.
64
+
43
65
  ## Protocol Coverage Map
44
66
  - conversation-compression: before each dispatch batch, withdraw/profile context; after each batch, deposit status/files/decisions/blockers; never echo raw subagent output.
45
67
  - decision-protocol: Standard+ trade-off/design work gets independent research, synthesis verdict, recommendation, confidence, blind spots; Critical adds wider review.
@@ -78,12 +100,13 @@ Every \`runSubagent\` prompt includes all of:
78
100
  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\`.
79
101
  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.
80
102
  5. **Artifacts Path** — active flow's run dir / artifacts path from \`flow({ action: 'status' })\`.
81
- 6. **FORGE** — tier, task_id, evidence requirements. Reviewers add CRITICAL/HIGH claims into your task_id; never create their own.
103
+ 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.
82
104
  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."
83
105
  8. ${a().replace(/\n/g,`
84
106
  `)}
85
107
  9. **Self-Review** — checklist before declaring status: scope respected? tests pass? conventions followed?
86
108
  10. **Return contract** — \`DONE\` | \`DONE_WITH_CONCERNS\` | \`NEEDS_CONTEXT\` | \`BLOCKED\`. ≤200 words: status, files, decisions. Full detail only if BLOCKED.
109
+ 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.
87
110
 
88
111
  Always pass \`agentName\`. Missing/empty is a dispatch bug.
89
112
 
@@ -110,6 +133,7 @@ ${r({audience:`agent`})}
110
133
  ## Evidence + Validation
111
134
  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.
112
135
  After implementation batches: check({}) + test_run({}) once, then blast_radius for shared/public changes.
136
+ 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.
113
137
 
114
138
  ## Presentation
115
139
  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.
@@ -128,8 +152,9 @@ Use present for summaries, reports, evidence maps, task plans, batch results, ve
128
152
  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.
129
153
 
130
154
  ## End
131
- - reindex after structural changes; produce_knowledge for durable updates; remember non-trivial decisions.
132
- - L0 card maintenance: changed topics after flow completion schedule L0 card regeneration via \`briefing-card-compiler\`.
155
+ - After write flows: onboard({ path, update: true }) → reindex({}) → produce_knowledge({}). L0 card regen via \`briefing-card-compiler\` if structural change detected.
156
+ - After read-only/epilogue-only flows: no reindex (0 token cost). remember decisions as normal.
157
+ - If re-onboard/reindex fails: log warning, surface in flow status, do not block.
133
158
  - Flow-derived promotion: evidence-backed promotion candidates from final consolidation; confidence alone never promotes.
134
159
  - session_digest({ persist: true }).`,Planner:`${i()}
135
160
 
@@ -465,9 +490,26 @@ After shared bootstrap, run \`search({ query: "security vulnerabilities conventi
465
490
 
466
491
  > **Reminder:** Follow ## MANDATORY FIRST ACTION from your shared base protocol.
467
492
 
493
+ ## Tier Composition: Evidence × Docs Generation
494
+
495
+ Two independent tier dimensions compose: **evidence protocol** (who you report to) and **docs generation** (what you produce). Both use the same FORGE \`tier\` value, but govern different behaviors.
496
+
497
+ | Tier | Evidence Protocol | Docs Generation | Short-circuit Gate |
498
+ |------|------------------|----------------|-------------------|
499
+ | Floor | file:line citations only. No \`evidence_map\`. | State tracking only. Skip generation. See SKILL.md ┬╗ Tier Branch Table. | Orchestrator may skip dispatch if changeManifest = NONE/COSMETIC only |
500
+ | Standard | Add 2-4 CRITICAL/HIGH findings with receipts. | Surgical: regenerate only affected docs + cross-ref validation. | N/A — dispatch always runs |
501
+ | Critical | All CRITICAL/HIGH findings; tag contract/security claims with \`safety_gate\`. | Full Phase 1-7 + phases matching change type. | N/A — dispatch always runs |
502
+
503
+ **Docs generation branching is defined in SKILL.md ┬╗ Tier Branching — not duplicated here.** This file controls evidence protocol only.
504
+
468
505
  ## Documentation Protocol
469
506
 
470
507
  1. **AI Kit Recall** — \`search({ query: "documentation <area>" })\` + \`knowledge({ action: "list" })\`
508
+ 1a. **Freshness check** (E4 Knowledge↔Docs Bridge): After recall, check L2 lessons against existing docs for staleness. Session-level dedup per topic.
509
+ - \`search({ query: "recent lessons about <target domain>" })\`
510
+ - \`knowledge({ action: 'lesson', subAction: 'list-lessons', topic: '<target domain>' })\`
511
+ - If any \`lesson.updatedAt > doc._lastSynced.syncedAt\`: emit \`[FRESHNESS WARNING]\` in output
512
+ - Run BEFORE Analyze step so freshness signals inform evidence gathering
471
513
  2. **Analyze** — \`analyze({ items: [{aspect: "structure", ...}] })\`, \`analyze({ items: [{aspect: "entry_points", ...}] })\`, \`file_summary({ files, tier: 'T1' })\`
472
514
  3. **Draft** — write docs following project conventions
473
515
  4. **Cross-reference** — link related docs, keep consistency
@@ -139,7 +139,29 @@ Default: Context + Container. Add Component only for a complex container and a c
139
139
 
140
140
  1. **Study examples first**: Load references/ example files to understand visual patterns, label density, and layout conventions before generating.
141
141
  2. Identify audience and decision the diagram supports.
142
- 3. Gather evidence with AI Kit: analyze/graph/search/file_summary.
142
+ 3. **Gather evidence with AI Kit - check onboard cache FIRST:**
143
+ a. **Check onboard cache:**
144
+ - Run status({ includePrelude: true }) - if workspaceCore shows onboard data available:
145
+ - Read cache from ~/.aikit/workspaces/<hash>/onboard/:
146
+ - structure.md - module tree, layers, directory shape
147
+ - dependencies.md - internal/external dependency graph
148
+ - symbols.md - exported symbols, type signatures
149
+ - 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.
153
+ b. **Use cache data for C4:**
154
+ - Extract layers from structure analysis (layer-detector classifications)
155
+ - Extract modules/containers from directory tree
156
+ - Extract dependency arrows from cross-module imports
157
+ - Identify external systems from external dependency listing
158
+ c. **Fallback (if cache missing or stale):**
159
+ - analyze({ items: [{aspect: "structure"}, {aspect: "dependencies"}, {aspect: "entry_points"}] })
160
+ - 3 aspects instead of 6 - symbols + patterns + diagram aspects add cost but not essential for C4 topology
161
+ d. **Supplementary context (always runs):**
162
+ - graph({ action: find_nodes, name_pattern: <system> }) for relationship graph
163
+ - search({ query: <system> technology stack }) for tech details
164
+ - file_summary({ files, tier: T1 }) for individual file structure when needed
143
165
  4. Pick level(s); avoid mixing levels in one diagram.
144
166
  5. **Generate structured diagram JSON** conforming to the centralized diagram schema (see ~/.aikit/resources/renderers/schemas/). Render via CLI:
145
167