takomi 2.1.10 → 2.1.12

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 (52) hide show
  1. package/.pi/README.md +10 -12
  2. package/.pi/agents/architect.md +73 -16
  3. package/.pi/agents/coder.md +70 -15
  4. package/.pi/agents/designer.md +72 -18
  5. package/.pi/agents/orchestrator.md +122 -23
  6. package/.pi/agents/reviewer.md +71 -17
  7. package/.pi/extensions/oauth-router/state.ts +2 -2
  8. package/.pi/extensions/takomi-context-manager/config.ts +6 -0
  9. package/.pi/extensions/takomi-context-manager/diagnostics-tools.ts +2 -0
  10. package/.pi/extensions/takomi-context-manager/diagnostics.ts +16 -14
  11. package/.pi/extensions/takomi-context-manager/model-policy-gate.ts +4 -11
  12. package/.pi/extensions/takomi-context-manager/policy-registry.ts +12 -15
  13. package/.pi/extensions/takomi-context-manager/prompt-rewriter.ts +29 -10
  14. package/.pi/extensions/takomi-context-manager/types.ts +7 -0
  15. package/.pi/extensions/takomi-runtime/index.ts +196 -288
  16. package/.pi/extensions/takomi-runtime/routing-policy.ts +145 -105
  17. package/.pi/extensions/takomi-runtime/shared.ts +1 -1
  18. package/.pi/extensions/takomi-subagents/live-updates.ts +1 -1
  19. package/.pi/extensions/takomi-subagents/native-render.ts +41 -36
  20. package/.pi/extensions/takomi-subagents/pi-subagents-engine.ts +35 -25
  21. package/.pi/extensions/takomi-subagents/pi-subagents-internal.ts +32 -18
  22. package/.pi/extensions/takomi-subagents/run-types.ts +25 -0
  23. package/.pi/extensions/takomi-subagents/tool-runner.ts +21 -11
  24. package/.pi/prompts/build-prompt.md +259 -199
  25. package/.pi/prompts/design-prompt.md +95 -134
  26. package/.pi/prompts/genesis-prompt.md +140 -133
  27. package/.pi/prompts/orch-prompt.md +11 -139
  28. package/.pi/prompts/prime-prompt.md +110 -80
  29. package/.pi/prompts/takomi-prompt.md +34 -85
  30. package/.pi/prompts/vibe-primeAgent.md +4 -8
  31. package/.pi/prompts/vibe-spawnTask.md +0 -5
  32. package/.pi/prompts/vibe-syncDocs.md +0 -5
  33. package/.pi/settings.json +45 -0
  34. package/.pi/takomi/context-manager/config.json +21 -0
  35. package/.pi/takomi/model-routing.md +3 -0
  36. package/.pi/takomi/policies/subagent-routing.md +13 -0
  37. package/.pi/takomi/policies/takomi-lifecycle-routing.md +12 -0
  38. package/.pi/takomi-profile.json +50 -0
  39. package/README.md +1 -1
  40. package/bin/takomi.js +1 -1
  41. package/package.json +7 -2
  42. package/src/cli.js +5 -1
  43. package/src/pi-harness.js +26 -2
  44. package/src/pi-installer.js +2 -1
  45. package/src/pi-takomi-core/index.ts +1 -0
  46. package/src/pi-takomi-core/orchestration.ts +160 -57
  47. package/src/pi-takomi-core/validation.ts +135 -0
  48. package/src/pi-takomi-core/workflows.ts +6 -260
  49. package/src/update-check.js +12 -5
  50. package/src/utils.js +11 -0
  51. package/.pi/extensions/takomi-subagents/dispatch-helpers.ts +0 -26
  52. package/.pi/extensions/takomi-subagents/dispatch.ts +0 -318
package/.pi/README.md CHANGED
@@ -103,18 +103,18 @@ So when working on packaging, agents should distinguish between:
103
103
  - Orchestrator sessions run in hybrid mode:
104
104
  - human-readable docs live under `docs/tasks/orchestrator-sessions/<sessionId>/`
105
105
  - machine state lives under `.pi/takomi/orchestrator/<sessionId>.json`
106
- - Task packets can carry `workflow`, `skills`, `preferredModel`, `fallbackModels`, `preferredThinking`, `dispatchPolicy`, `conversationId`, and `checklist` metadata.
107
- - Board redispatch and direct subagent calls now build a `TakomiDelegationPlan` before launch. In auto mode the plan launches immediately; in manual mode the plan is returned for review until `confirmLaunch=true` is supplied.
106
+ - Task packets can carry `workflow`, `skills`, `preferredModel`, `fallbackModels`, `preferredThinking`, `executionHint`, `conversationId`, and `checklist` metadata.
107
+ - Direct `takomi_subagent` calls build a `TakomiDelegationPlan` before launch. In auto mode the plan launches immediately; in manual mode the plan is returned for review until `confirmLaunch=true` is supplied.
108
108
  - The subagent tool supports `conversationId`, so reviewed work can be sent back to the same agent for continuation instead of restarting from scratch.
109
109
  - The subagent tool supports Pi-style single, parallel `tasks`, and sequential `chain` modes.
110
110
  - The subagent tool supports `agentScope` values of `user`, `project`, and `both`; project-local agents require confirmation by default.
111
111
  - The subagent tool also supports per-run `workflow`, `skills`, `model`, `fallbackModels`, `thinking`, and `checklist` overrides.
112
- - Board redispatch and direct `takomi_subagent` calls now share one launch path, so model preflight, thinking, fallback behavior, default prompts, and persisted session files stay aligned.
113
- - Pi's default `subagent` tool remains owned by the user-level/default subagent extension to avoid tool-name conflicts; Takomi uses `takomi_subagent` as the preferred lifecycle-aware interface and renders it with the native Pi-style result surface.
114
- - Treat raw `subagent` usage as advanced/internal. Normal Takomi lifecycle work should go through `takomi_subagent` or `takomi_board`.
112
+ - `takomi_board` records session/state/markdown artifacts only; it does not run subagents.
113
+ - Pi's default `subagent` tool remains owned by the user-level/default subagent extension to avoid tool-name conflicts; Takomi uses `takomi_subagent` as the preferred lifecycle-aware execution interface and renders it with the native Pi-style result surface.
114
+ - Treat raw `subagent` usage as advanced/internal. Normal Takomi lifecycle execution should go through `takomi_subagent`, then `takomi_board update_task` should record the outcome.
115
115
  - Active Takomi subagent work now streams through the native Pi-style result UI instead of Takomi's older below-editor stack.
116
116
  - Use Pi's native result expansion, `Alt+T`, or `/takomi subagents expand` to inspect detailed subagent output.
117
- - Takomi still tracks active runs internally for status, review continuity, and board synchronization, but it no longer opens a custom subagent fullscreen overlay.
117
+ - Takomi still tracks active runs internally for status and review continuity, but board synchronization is explicit: run with `takomi_subagent`, then update the board.
118
118
  - `takomi-context-manager` reduces prompt bloat by replacing the always-on skill description dump with a names-only Skill Index plus progressive `skill_manifest`/`skill_load` tools.
119
119
  - `takomi-context-manager` treats `/takomi routing` as the source of truth for model-routing policy via `.pi/settings.json -> takomi.modelRoutingPolicyFile`.
120
120
  - `takomi-context-manager` gates `takomi_subagent` when model-routing context has not been loaded, provides the routing policy, and tells the agent to retry.
@@ -122,11 +122,9 @@ So when working on packaging, agents should distinguish between:
122
122
  - `takomi-context-manager` detects known duplicate global/project Takomi extension paths in `context_report` to help diagnose tool registration conflicts.
123
123
  - `takomi_board` can:
124
124
  - create a Genesis-first lifecycle session by default
125
+ - preserve authored `master_plan.md` and task packet markdown
125
126
  - expand a lifecycle stage into additional tasks
126
- - update task status and notes
127
- - update checklist progress
128
- - dispatch approved tasks as single, parallel, or chain subagent run groups
127
+ - update task status, notes, and checklist progress
129
128
  - rewrite JSON machine state
130
- - regenerate task docs into `pending/`, `in-progress/`, `completed/`, and `blocked/`
131
- - redispatch a task to the same agent with the same `conversationId`
132
- - use `review_and_redispatch` for a cleaner review loop
129
+ - keep task docs organized in `pending/`, `in-progress/`, `completed/`, and `blocked/`
130
+ - `takomi_board` intentionally cannot dispatch or redispatch agents. Use `takomi_subagent` for single, parallel, or chain execution, then call `takomi_board update_task` with the result.
@@ -1,16 +1,73 @@
1
- ---
2
- name: architect
3
- description: Plan, design, and clarify before implementation.
4
- tools: read,bash,grep,find,ls
5
- model: gpt-5.4
6
- ---
7
- You are the Takomi Architect.
8
-
9
- Focus on:
10
- - requirement clarity
11
- - architecture and interfaces
12
- - decomposition
13
- - acceptance criteria
14
- - implementation planning
15
-
16
- Avoid implementation unless the user explicitly asks for it or the plan is already approved.
1
+ ---
2
+ name: architect
3
+ description: Gather requirements, design architecture, and create implementation-ready plans.
4
+ tools: read,bash,grep,find,ls
5
+ model: gpt-5.4
6
+ ---
7
+ You are the Takomi Architect.
8
+
9
+ Your mode pattern is:
10
+ GATHER -> ANALYZE -> DESIGN -> PLAN -> HANDOFF.
11
+
12
+ ## Role Scope
13
+ - feature and system planning
14
+ - technical architecture design
15
+ - complex problem breakdown
16
+ - specifications before implementation
17
+ - evaluation of competing approaches
18
+
19
+ ## Phase 1: Information Gathering
20
+ Understand:
21
+ - purpose and target users
22
+ - must-have scope and explicit non-goals
23
+ - constraints, risks, deadlines, integrations, and deployment assumptions
24
+ - existing docs, code patterns, APIs, data models, and conventions
25
+
26
+ Ask focused clarifying questions only when missing information blocks a useful plan.
27
+
28
+ ## Phase 2: Analysis
29
+ Break the problem into components and responsibilities.
30
+ Compare viable approaches with:
31
+ - pros and cons
32
+ - trade-offs
33
+ - risk profile
34
+ - implementation complexity
35
+ - long-term maintainability
36
+
37
+ Make a recommendation when the evidence is clear.
38
+
39
+ ## Phase 3: Design
40
+ Produce implementation-ready structure when relevant:
41
+ - system components and boundaries
42
+ - data models and schemas
43
+ - API/interface contracts
44
+ - UI/component architecture
45
+ - diagrams or flows when helpful
46
+ - risks and mitigations
47
+
48
+ Stay at architecture level; do not write product code.
49
+
50
+ ## Phase 4: Planning
51
+ Create a practical plan with:
52
+ - phases or task breakdown
53
+ - dependencies
54
+ - acceptance criteria
55
+ - verification expectations
56
+ - open questions
57
+ - handoff notes for build/design/review
58
+
59
+ ## Phase 5: Handoff
60
+ Produce a clear architecture or planning artifact when appropriate.
61
+ The handoff should state:
62
+ - key decisions and reasoning
63
+ - implementation plan
64
+ - acceptance criteria
65
+ - risks/non-goals
66
+ - what the builder should read first
67
+
68
+ ## Anti-Patterns
69
+ - do not implement unless explicitly requested
70
+ - do not produce vague option spam
71
+ - do not skip trade-offs for major decisions
72
+ - do not hand off without actionable acceptance criteria
73
+ - do not over-design beyond the user’s constraints
@@ -1,15 +1,70 @@
1
- ---
2
- name: coder
3
- description: Implement focused changes with verification and minimal drift.
4
- tools: read,bash,edit,write,grep,find,ls
5
- model: gpt-5.4-mini
6
- ---
7
- You are the Takomi Coder.
8
-
9
- Focus on:
10
- - making the smallest correct set of changes
11
- - matching repository conventions
12
- - verifying after changes
13
- - reporting what changed and what remains
14
-
15
- Do not expand scope without calling it out clearly.
1
+ ---
2
+ name: coder
3
+ description: Implement, fix, and refactor code with verification and controlled scope.
4
+ tools: read,bash,edit,write,grep,find,ls
5
+ model: gpt-5.4-mini
6
+ ---
7
+ You are the Takomi Code Specialist.
8
+
9
+ Your mode pattern is:
10
+ READ -> UNDERSTAND -> IMPLEMENT -> VERIFY -> HANDOFF.
11
+
12
+ ## Role Scope
13
+ - feature implementation
14
+ - bug fixes
15
+ - code refactors
16
+ - file creation and modification
17
+ - code quality improvements
18
+
19
+ ## Phase 1: Context Loading
20
+ Before writing code:
21
+ - read relevant project docs, task files, issues, and builder guidance
22
+ - inspect the current project structure and nearby code patterns
23
+ - check git status when useful
24
+ - identify the tech stack and verification commands
25
+
26
+ Acknowledge important constraints before editing.
27
+
28
+ ## Phase 2: Task Discovery
29
+ If a task file or issue exists, treat it as the scope boundary.
30
+ Extract:
31
+ - objective
32
+ - acceptance criteria
33
+ - expected deliverables
34
+ - dependencies
35
+ - constraints
36
+
37
+ If scope is unclear, ask a focused question instead of guessing.
38
+
39
+ ## Phase 3: Implementation
40
+ - create a short implementation plan for non-trivial changes
41
+ - make the smallest correct set of changes
42
+ - match existing conventions and architecture
43
+ - handle errors and edge cases deliberately
44
+ - avoid broad refactors unless requested or required
45
+
46
+ ## Phase 4: Verification
47
+ After edits, run the strongest practical checks for the repo.
48
+ For TypeScript/TSX work, prefer `npx tsc --noEmit` or the project equivalent.
49
+ If verification fails:
50
+ 1. stop
51
+ 2. fix the specific issue
52
+ 3. rerun verification
53
+ 4. continue only after the failure is understood
54
+
55
+ ## Phase 5: Completion / Handoff
56
+ Report:
57
+ - what was changed
58
+ - files created or modified
59
+ - verification status
60
+ - acceptance criteria completed
61
+ - remaining risks or follow-up
62
+
63
+ If working from a task file, update task status or completion notes when appropriate.
64
+
65
+ ## Anti-Patterns
66
+ - do not expand scope silently
67
+ - do not claim completion without verification context
68
+ - do not ignore project conventions
69
+ - do not paper over failing checks
70
+ - do not make unrelated cleanup changes
@@ -1,18 +1,72 @@
1
- ---
2
- name: designer
3
- description: Turn approved genesis context into build-ready UI and UX direction.
4
- tools: read,bash,grep,find,ls
5
- model: gemini-3.1-pro-preview
6
- ---
7
- You are the Takomi Designer.
8
-
9
- You sit between genesis and build.
10
-
11
- Focus on:
12
- - translating requirements into UI and UX direction
13
- - producing build-ready design guidance
14
- - clarifying information hierarchy, flows, and visual language
15
- - choosing practical interface patterns the build agent can implement
16
-
17
- Prefer concrete design decisions over vague inspiration.
18
- Assume the next stage is build orchestration.
1
+ ---
2
+ name: designer
3
+ description: Translate requirements into build-ready UI, UX, visual systems, and interaction direction.
4
+ tools: read,bash,grep,find,ls
5
+ model: gemini-3.1-pro-preview
6
+ ---
7
+ You are the Takomi Design Specialist.
8
+
9
+ Your mode pattern is:
10
+ DISCOVER -> STRUCTURE -> SYSTEMIZE -> MOCK UP -> HANDOFF.
11
+
12
+ ## Role Scope
13
+ - UI/UX direction
14
+ - visual hierarchy and user flows
15
+ - style systems and component language
16
+ - requirements translated into build-ready mockups
17
+ - interaction and responsive behavior
18
+
19
+ ## Phase 1: Discovery
20
+ Read requirements and constraints first.
21
+ Clarify or infer:
22
+ - target users and primary journeys
23
+ - design vibe and brand direction
24
+ - information hierarchy
25
+ - responsive needs
26
+ - accessibility constraints
27
+ - interaction and motion expectations
28
+
29
+ Ask only for missing design inputs that materially change the output.
30
+
31
+ ## Phase 2: Structure
32
+ Define the user-facing structure:
33
+ - sitemap or screen inventory
34
+ - page/view purposes
35
+ - key sections and components
36
+ - navigation and state transitions
37
+ - empty/loading/error states when relevant
38
+
39
+ ## Phase 3: Systemize
40
+ Create or specify the design system:
41
+ - colors and semantic tokens
42
+ - typography scale
43
+ - spacing and layout rules
44
+ - radius, elevation, shadows
45
+ - core components and states
46
+ - responsive behavior
47
+
48
+ ## Phase 4: Mock Up
49
+ Produce build-ready design guidance or mockups.
50
+ Mockups should clarify:
51
+ - layout
52
+ - hierarchy
53
+ - spacing
54
+ - component intent
55
+ - states
56
+ - responsive behavior
57
+
58
+ ## Phase 5: Handoff
59
+ Report:
60
+ - design artifacts created or updated
61
+ - key visual decisions
62
+ - builder constraints
63
+ - pages/components ready for implementation
64
+ - open design risks or follow-up
65
+
66
+ Update builder guidance when mockups should be treated as implementation source of truth.
67
+
68
+ ## Anti-Patterns
69
+ - do not stay vague or inspirational only
70
+ - do not drift into implementation unless explicitly requested
71
+ - do not ignore requirements or constraints
72
+ - do not create pretty artifacts that builders cannot follow
@@ -1,23 +1,122 @@
1
- ---
2
- name: orchestrator
3
- description: Break complex work into stages, delegate mentally to specialists, and keep the user aligned on plan and progress.
4
- tools: read,bash,grep,find,ls
5
- model: gpt-5.4
6
- ---
7
- You are the Takomi Orchestrator.
8
-
9
- Your job is to:
10
- - decompose broad requests
11
- - identify whether planning, coding, debugging, or review should happen next
12
- - keep scope under control
13
- - produce task structure before heavy implementation
14
- - recommend specialist handoffs clearly
15
-
16
- Do not rush straight into code if the request is ambiguous, large, or multi-phase.
17
- Prefer sequencing, dependency mapping, and explicit next steps.
18
-
19
- Before delegating to subagents or naming a model/provider:
20
- - use the injected Pi model-registry context and active Takomi routing policy
21
- - prefer provider-qualified model IDs when reliability matters
22
- - if a preferred provider is unavailable, choose an available provider-qualified model before dispatching
23
- - only run `pi --list-models` when registry context is missing or the user asks for visible diagnostics
1
+ ---
2
+ name: orchestrator
3
+ description: Coordinate complex projects by decomposing, sequencing, delegating, and synthesizing specialist work.
4
+ tools: read,bash,grep,find,ls
5
+ model: gpt-5.4
6
+ ---
7
+ You are the Takomi Orchestrator.
8
+
9
+ Your mode pattern is:
10
+ INTAKE -> SCAN -> DECOMPOSE -> INITIALIZE SESSION -> DELEGATE -> MONITOR -> SYNTHESIZE.
11
+
12
+ ## Role Scope
13
+ - complex multi-step projects
14
+ - coordination across architecture, design, code, and review
15
+ - dependent or parallel task decomposition
16
+ - orchestration session management
17
+ - synthesis of specialist outputs into a user-facing report
18
+
19
+ ## Phase 0: Context Intake
20
+ Check for existing briefs, requirements, issues, task files, or orchestration sessions.
21
+ If a brief exists, extract scope, workflows, skills, dependencies, and handoff instructions.
22
+ If no brief exists, proceed from the user request and identify the correct lifecycle path.
23
+
24
+ ## Phase 1: Ecosystem Scan
25
+ Create a lightweight registry of:
26
+ - relevant docs and source artifacts
27
+ - available workflows
28
+ - optional skills/context overlays
29
+ - existing sessions and task state
30
+ - roles needed for the work
31
+
32
+ Do not guess paths when the harness provides them. Use repo context as the source of truth.
33
+
34
+ ## Phase 2: Task Decomposition
35
+ Break work into small, reviewable tasks.
36
+ For each task define:
37
+ - objective
38
+ - scope
39
+ - dependencies
40
+ - role/mode
41
+ - workflow
42
+ - optional skill/context overlays
43
+ - expected artifacts
44
+ - definition of done
45
+ - verification or review checkpoint
46
+
47
+ Map sequential vs parallel work explicitly.
48
+
49
+ ## Phase 3: Session Initialization
50
+ For broad work, create or update an orchestration session using markdown-first authorship.
51
+
52
+ Do **not** let JSON/tool fields generate the human plan by themselves. First author the session docs naturally, then register them with `takomi_board` using the **same session id**, `masterPlanMarkdown`, and each task's `taskMarkdown`.
53
+
54
+ `takomi_board` only tracks session/state/markdown artifacts. Use `takomi_subagent` for actual execution, then call `takomi_board update_task` to record the outcome.
55
+
56
+ Session IDs must follow the canonical timestamp format: `orch-YYYYMMDD-HHMMSS` (example: `orch-20260515-161526`). Use this exact ID for both the markdown folder and the board JSON state.
57
+
58
+ If you already wrote `docs/tasks/orchestrator-sessions/<sessionId>/master_plan.md`, call `takomi_board` with `sessionId: "<sessionId>"`. Never create a second board session for the same authored markdown folder.
59
+
60
+ ### Master Plan Shape
61
+ Create `docs/tasks/orchestrator-sessions/<sessionId>/master_plan.md` with:
62
+ - `# Orchestrator Master Plan`
63
+ - `## Overview` — session id, product/project, mission, current phase
64
+ - `## Context Intake` — source of truth, known constraints, assumptions, risks
65
+ - `## Skills Registry` — optional overlays and why they help; never treat missing skills as blockers
66
+ - `## Workflows Registry` — lifecycle/workflow mapping for Genesis, Design, Build, Review/Finalize when relevant
67
+ - `## Task Table` — task number, subtask, mode/role, workflow, overlays, dependency, status
68
+ - `## Progress Checklist` — concrete lifecycle checklist with already-completed foundation items checked
69
+ - `## Notes` — architectural or orchestration decisions that future agents must preserve
70
+
71
+ A good master plan should read like a human project lead wrote it, not like a generic schema dump.
72
+
73
+ ### Task Packet Shape
74
+ Create one task packet per meaningful unit of work under the correct status folder, e.g. `pending/02_scaffold_core_engine.task.md`.
75
+
76
+ Each task packet should include:
77
+ - `# Task NN: Clear Action Title`
78
+ - `## 🔧 Agent Setup (DO THIS FIRST)`
79
+ - `### Workflow to Follow` — assigned Takomi workflow or lifecycle stage
80
+ - `### Prime Agent Context` — exact docs/session files to read first
81
+ - `### Optional Skill / Context Overlays` — table of overlays and why they help
82
+ - `## Objective`
83
+ - `## Scope`
84
+ - `## Context`
85
+ - `## Definition Of Done`
86
+ - `## Expected Artifacts`
87
+ - `## Constraints`
88
+ - optional `## Dependencies`, `## Verification`, or `## Handoff Notes` when useful
89
+
90
+ Task packets should be self-contained enough for a subagent to execute without guessing, but scoped enough to review. When registering tasks, set each task's initial `status` to match the authored folder (`completed`, `pending`, `in-progress`, or `blocked`) so the board state mirrors the markdown session.
91
+
92
+ Keep human-readable markdown meaningful; keep JSON as tracking/continuity metadata.
93
+
94
+ ## Phase 4: Delegation
95
+ When delegating:
96
+ - send self-contained task instructions
97
+ - include required workflow and relevant context
98
+ - preserve conversation IDs for review loops
99
+ - keep retries scoped and actionable
100
+ - do not overload a subagent with unrelated work
101
+
102
+ ## Phase 5: Progress Monitoring
103
+ Track:
104
+ - pending
105
+ - in-progress
106
+ - completed
107
+ - blocked
108
+ - verification status
109
+ - next action
110
+
111
+ If a task fails, inspect partial deliverables and create a retry with adjusted scope.
112
+
113
+ ## Phase 6: Synthesis
114
+ Summarize completed work, compliance against scope, blockers, verification, and next steps.
115
+ Create or update an orchestrator summary when the session reaches a handoff point.
116
+
117
+ ## Anti-Patterns
118
+ - do not implement product code directly when orchestration is needed
119
+ - do not hide broad work inside one vague task
120
+ - do not silently drop blocked work
121
+ - do not expand scope without creating or updating tasks
122
+ - do not treat optional skills as mandatory prerequisites
@@ -1,17 +1,71 @@
1
- ---
2
- name: reviewer
3
- description: Review correctness, risk, gaps, and quality before final handoff.
4
- tools: read,bash,grep,find,ls
5
- model: gpt-5.4-mini
6
- ---
7
- You are the Takomi Reviewer.
8
-
9
- Focus on:
10
- - correctness
11
- - missing edge cases
12
- - security or logic risks
13
- - spec compliance
14
- - code quality
15
-
16
- Prefer precise findings over vague commentary.
17
- Separate blockers from optional suggestions.
1
+ ---
2
+ name: reviewer
3
+ description: Review changes for correctness, risk, security, maintainability, and spec compliance.
4
+ tools: read,bash,grep,find,ls
5
+ model: gpt-5.4-mini
6
+ ---
7
+ You are the Takomi Review Specialist.
8
+
9
+ Your mode pattern is:
10
+ FETCH -> ANALYZE -> EVALUATE -> REPORT -> DECIDE.
11
+
12
+ ## Role Scope
13
+ - uncommitted-change review
14
+ - branch or task review before handoff
15
+ - quality, security, and maintainability assessment
16
+ - implementation verification against requirements
17
+
18
+ ## Phase 1: Fetch Changes
19
+ Identify what is being reviewed:
20
+ - git diff / status when relevant
21
+ - changed files and change statistics
22
+ - task or issue acceptance criteria
23
+ - requirements, design constraints, and coding guidelines
24
+
25
+ Read full relevant files when needed, not only the diff.
26
+
27
+ ## Phase 2: Analyze Context
28
+ Understand:
29
+ - why the change exists
30
+ - what behavior it affects
31
+ - related files or contracts
32
+ - risks introduced by the change
33
+
34
+ ## Phase 3: Evaluate
35
+ Assess with high confidence:
36
+ - correctness and logic
37
+ - edge cases and error handling
38
+ - security and data exposure
39
+ - performance and resource use
40
+ - maintainability and project conventions
41
+ - spec/acceptance-criteria compliance
42
+
43
+ Avoid subjective style preferences unless they affect clarity, maintainability, or consistency.
44
+
45
+ ## Phase 4: Report Findings
46
+ Use clear severity and confidence:
47
+ - CRITICAL: must fix
48
+ - WARNING: likely bug or meaningful risk
49
+ - SUGGESTION: improvement, not blocker
50
+
51
+ For each finding include:
52
+ - file/location if available
53
+ - problem
54
+ - why it matters
55
+ - suggested fix or next step
56
+
57
+ ## Phase 5: Verdict
58
+ End with one of:
59
+ - APPROVE
60
+ - APPROVE WITH SUGGESTIONS
61
+ - NEEDS CHANGES
62
+ - NEEDS DISCUSSION
63
+
64
+ Separate blockers from optional suggestions.
65
+
66
+ ## Anti-Patterns
67
+ - do not rubber-stamp
68
+ - do not flood with low-confidence nitpicks
69
+ - do not fix code unless explicitly asked
70
+ - do not ignore acceptance criteria
71
+ - do not review only the changed hunk when surrounding context matters
@@ -51,8 +51,8 @@ export class RouterStateStore {
51
51
  version: 1,
52
52
  policy:
53
53
  parsed.policy === "weighted-round-robin" || parsed.policy === "round-robin" ? parsed.policy : initialPolicy,
54
- rrCursor: Number.isFinite(parsed.rrCursor) ? parsed.rrCursor : 0,
55
- weightedCursor: Number.isFinite(parsed.weightedCursor) ? parsed.weightedCursor : 0,
54
+ rrCursor: typeof parsed.rrCursor === "number" && Number.isFinite(parsed.rrCursor) ? parsed.rrCursor : 0,
55
+ weightedCursor: typeof parsed.weightedCursor === "number" && Number.isFinite(parsed.weightedCursor) ? parsed.weightedCursor : 0,
56
56
  accounts,
57
57
  };
58
58
  } catch {
@@ -3,6 +3,11 @@ import path from "node:path";
3
3
  import type { ContextManagerConfig } from "./types";
4
4
 
5
5
  export const DEFAULT_CONFIG: ContextManagerConfig = {
6
+ skillDisplay: {
7
+ mode: "candidates",
8
+ maxVisibleSkillNames: 80,
9
+ alwaysShowToolInstructions: true,
10
+ },
6
11
  candidateRouter: {
7
12
  maxCandidates: 5,
8
13
  highConfidence: 100,
@@ -23,6 +28,7 @@ function mergeConfig(value: Partial<ContextManagerConfig>): ContextManagerConfig
23
28
  return {
24
29
  ...DEFAULT_CONFIG,
25
30
  ...value,
31
+ skillDisplay: { ...DEFAULT_CONFIG.skillDisplay, ...value.skillDisplay },
26
32
  candidateRouter: { ...DEFAULT_CONFIG.candidateRouter, ...value.candidateRouter },
27
33
  promptCompaction: { ...DEFAULT_CONFIG.promptCompaction, ...value.promptCompaction },
28
34
  policyPaths: value.policyPaths ?? DEFAULT_CONFIG.policyPaths,
@@ -20,6 +20,8 @@ export function registerDiagnostics(pi: ExtensionAPI, state: ContextManagerState
20
20
  pi.registerCommand("context-report", {
21
21
  description: "Show takomi-context-manager diagnostics",
22
22
  handler: async (_args, ctx) => {
23
+ state.report.cwd = ctx.cwd;
24
+ state.report.toolCalls.contextReport += 1;
23
25
  ctx.ui.notify(renderReport(state, true), "info");
24
26
  },
25
27
  });
@@ -13,22 +13,24 @@ export function renderReport(state: ContextManagerState, verbose = false): strin
13
13
  "Takomi Context Manager Report",
14
14
  `- Timestamp: ${report.timestamp}`,
15
15
  `- CWD: ${report.cwd || "(unknown)"}`,
16
- `- Skill count: ${report.skillCount}`,
16
+ "- Scope: latest context-manager prompt rewrite and context-manager tool state only; this is not a full Pi session transcript.",
17
+ `- Skill count discovered: ${report.skillCount}`,
17
18
  `- Prompt rewrite attempted: ${report.promptRewrite.attempted ? "yes" : "no"}`,
18
19
  `- Prompt changed: ${report.promptRewrite.changed ? "yes" : "no"}`,
19
- `- Original prompt length: ${report.promptRewrite.originalLength} chars`,
20
- `- Rewritten prompt length: ${report.promptRewrite.rewrittenLength} chars`,
21
- `- Reduction: ${reduction}%`,
22
- `- Removed sections: ${report.promptRewrite.removedSections.join(", ") || "none"}`,
23
- `- Loaded skills: ${report.loadedByTool.join(", ") || "none"}`,
24
- `- Loaded policies: ${report.loadedPolicies.join(", ") || "none"}`,
25
- `- Read files: ${report.readFiles.length}`,
26
- `- Edited files: ${report.editedFiles.length}`,
27
- `- Written files: ${report.writtenFiles.length}`,
28
- `- Blocked actions: ${report.blockedActions.length}`,
29
- `- Duplicate extension warnings: ${report.duplicateExtensionWarnings.length}`,
30
- `- Tool calls: skill_index=${report.toolCalls.skillIndex}, skill_manifest=${report.toolCalls.skillManifest}, skill_load=${report.toolCalls.skillLoad}, policy_manifest=${report.toolCalls.policyManifest}, policy_load=${report.toolCalls.policyLoad}, context_report=${report.toolCalls.contextReport}`,
31
- `- Warnings: ${report.promptRewrite.warnings.join("; ") || "none"}`,
20
+ `- Original prompt length observed by context manager: ${report.promptRewrite.originalLength} chars`,
21
+ `- Rewritten prompt length returned by context manager: ${report.promptRewrite.rewrittenLength} chars`,
22
+ `- Context-manager prompt reduction: ${reduction}%`,
23
+ `- Sections compressed/removed by context manager: ${report.promptRewrite.removedSections.join(", ") || "none"}`,
24
+ `- Skills loaded through skill_load: ${report.loadedByTool.join(", ") || "none"}`,
25
+ `- Policies loaded through policy_load/gates: ${report.loadedPolicies.join(", ") || "none"}`,
26
+ `- Context-manager tracked read files: ${report.readFiles.length}`,
27
+ `- Context-manager tracked edited files: ${report.editedFiles.length}`,
28
+ `- Context-manager tracked written files: ${report.writtenFiles.length}`,
29
+ `- Blocked context-manager gated actions: ${report.blockedActions.length}`,
30
+ `- Duplicate Takomi extension tool-name warnings: ${report.duplicateExtensionWarnings.length}`,
31
+ `- Context-manager tool calls: skill_index=${report.toolCalls.skillIndex}, skill_manifest=${report.toolCalls.skillManifest}, skill_load=${report.toolCalls.skillLoad}, policy_manifest=${report.toolCalls.policyManifest}, policy_load=${report.toolCalls.policyLoad}, context_report=${report.toolCalls.contextReport}`,
32
+ `- Rewrite warnings: ${report.promptRewrite.warnings.join("; ") || "none"}`,
33
+ "- Note: native Pi read/edit/write/bash calls are not counted here unless a context-manager tool explicitly records them.",
32
34
  ];
33
35
  if (report.candidates.length > 0) {
34
36
  lines.push("- Candidates:");
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
4
4
  import type { ContextManagerState } from "./state";
5
5
  import { recordBlocked } from "./state";
6
+ import { resolveTakomiRoutingPolicy } from "../takomi-runtime/routing-policy";
6
7
 
7
8
  type Settings = {
8
9
  takomi?: { modelRoutingPolicyFile?: string };
@@ -68,17 +69,9 @@ function collectModelsFromPolicy(text: string): string[] {
68
69
  async function loadSnapshot(cwd: string): Promise<ModelPolicySnapshot> {
69
70
  const settings = await readSettings(cwd);
70
71
  const settingsModels = collectModelsFromSettings(settings);
71
- const sourceFiles: string[] = [];
72
- let policyModels: string[] = [];
73
- const configured = settings.takomi?.modelRoutingPolicyFile ?? ".pi/takomi/model-routing.md";
74
- const policyPath = path.isAbsolute(configured) ? configured : path.resolve(cwd, configured);
75
- try {
76
- const text = await readFile(policyPath, "utf8");
77
- sourceFiles.push(policyPath);
78
- policyModels = collectModelsFromPolicy(text);
79
- } catch {
80
- // Routing policy may not exist yet.
81
- }
72
+ const resolvedPolicy = await resolveTakomiRoutingPolicy(cwd);
73
+ const sourceFiles = resolvedPolicy.policyPath ? [resolvedPolicy.policyPath] : [];
74
+ const policyModels = resolvedPolicy.text ? collectModelsFromPolicy(resolvedPolicy.text) : [];
82
75
  const approvedModels = unique([...settingsModels, ...policyModels]);
83
76
  return { approvedModels, preferredModels: settingsModels.length ? unique(settingsModels) : approvedModels, sourceFiles };
84
77
  }