takomi 2.0.4 → 2.0.6

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/README.md +26 -2
  2. package/assets/.agent/skills/code-review/SKILL.md +34 -81
  3. package/assets/.agent/skills/jstar-reviewer/SKILL.md +229 -0
  4. package/assets/.agent/skills/jstar-reviewer/agents/openai.yaml +7 -0
  5. package/assets/.agent/skills/takomi/SKILL.md +59 -0
  6. package/assets/.agent/skills/takomi/references/migration-map.md +28 -0
  7. package/assets/.agent/skills/takomi/workflows/agent_reset.md +173 -0
  8. package/assets/.agent/skills/takomi/workflows/escalate.md +112 -0
  9. package/assets/.agent/skills/takomi/workflows/migrate.md +135 -0
  10. package/assets/.agent/skills/takomi/workflows/mode-architect.md +422 -0
  11. package/assets/.agent/skills/takomi/workflows/mode-ask.md +294 -0
  12. package/assets/.agent/skills/takomi/workflows/mode-code.md +481 -0
  13. package/assets/.agent/skills/takomi/workflows/mode-debug.md +407 -0
  14. package/assets/.agent/skills/takomi/workflows/mode-orchestrator.md +222 -0
  15. package/assets/.agent/skills/takomi/workflows/mode-review.md +341 -0
  16. package/assets/.agent/skills/takomi/workflows/mode-visionary.md +186 -0
  17. package/assets/.agent/skills/takomi/workflows/optimize-agent-context.md +54 -0
  18. package/assets/.agent/skills/takomi/workflows/remotion-build.md +323 -0
  19. package/assets/.agent/skills/takomi/workflows/reverse_genesis.md +132 -0
  20. package/assets/.agent/skills/takomi/workflows/review_code.md +96 -0
  21. package/assets/.agent/skills/takomi/workflows/spawn-jstar-code-review.md +161 -0
  22. package/assets/.agent/skills/takomi/workflows/stitch.md +149 -0
  23. package/assets/.agent/skills/takomi/workflows/vibe-build.md +271 -0
  24. package/assets/.agent/skills/takomi/workflows/vibe-continueBuild.md +184 -0
  25. package/assets/.agent/skills/takomi/workflows/vibe-design.md +98 -0
  26. package/assets/.agent/skills/takomi/workflows/vibe-finalize.md +208 -0
  27. package/assets/.agent/skills/takomi/workflows/vibe-genesis.md +191 -0
  28. package/assets/.agent/skills/takomi/workflows/vibe-primeAgent.md +110 -0
  29. package/assets/.agent/skills/takomi/workflows/vibe-spawnTask.md +188 -0
  30. package/assets/.agent/skills/takomi/workflows/vibe-syncDocs.md +90 -0
  31. package/assets/.agent/workflows/review_code.md +96 -133
  32. package/assets/.agent/workflows/spawn-jstar-code-review.md +161 -121
  33. package/package.json +1 -1
  34. package/src/cli.js +7 -6
  35. package/src/store.js +4 -3
package/README.md CHANGED
@@ -50,6 +50,30 @@ Choose your weapons:
50
50
 
51
51
  ---
52
52
 
53
+ ## Codex Takomi Skills (No Slash Required)
54
+
55
+ Takomi now supports a full skill-native protocol path in Codex:
56
+ - Router skill: `takomi`
57
+ - Specialist skills: `takomi-*` (migrated from non-legacy workflows)
58
+ - Backward phrase aliases: `vibe genesis`, `vibe build`, `mode code`, and related prior names
59
+
60
+ Use natural language:
61
+
62
+ ```text
63
+ use takomi
64
+ use takomi genesis
65
+ run vibe genesis
66
+ continue build with takomi
67
+ ```
68
+
69
+ Install the Takomi protocol suite:
70
+
71
+ ```bash
72
+ npx -y skills add https://github.com/JStaRFilms/VibeCode-Protocol-Suite --skill takomi
73
+ ```
74
+
75
+ ---
76
+
53
77
  ## 📦 Skill Ecosystem
54
78
 
55
79
  Think of skills as specialized team members you can summon on demand. From security audits to AI video generation — there's a skill for that.
@@ -66,7 +90,7 @@ npx -y skills add https://github.com/JStaRFilms/VibeCode-Protocol-Suite
66
90
  ### Core Essentials (Start Here)
67
91
  The non-negotiables for daily development:
68
92
  ```bash
69
- npx -y skills add https://github.com/JStaRFilms/VibeCode-Protocol-Suite --skill ai-sdk --skill code-review --skill component-analysis --skill nextjs-standards --skill security-audit --skill spawn-task --skill stitch --skill sync-docs
93
+ npx -y skills add https://github.com/JStaRFilms/VibeCode-Protocol-Suite --skill takomi
70
94
  ```
71
95
 
72
96
  ### Convex Development Suite
@@ -168,7 +192,7 @@ Everything you need is in the **`.agent/`** folder.
168
192
 
169
193
  1. Copy the `.agent/` folder to your project root
170
194
  2. Your IDE automatically detects workflows and skills
171
- 3. Invoke with slash commands (e.g., `/init_vibecode_genesis`)
195
+ 3. Invoke with natural language in Codex (e.g., `use takomi genesis`) - slash commands are optional
172
196
 
173
197
  ### What's Inside `.agent/`
174
198
 
@@ -1,81 +1,34 @@
1
- ---
2
- name: code-review
3
- description: Run J-Star code review on staged changes. Analyze, fix P0/P1 issues, and iterate until clean.
4
- ---
5
-
6
- # Code Review Skill
7
-
8
- Run the J-Star Reviewer on staged changes, allowing iterative fixing of issues.
9
-
10
- ## When to Use
11
- - Before committing code changes
12
- - When code quality issues are mentioned
13
- - As a quality gate before merging
14
- - When user asks to "review this code"
15
-
16
- ## Quick Start
17
-
18
- ### 1. Build the Brain (First Time Only)
19
- ```bash
20
- jstar init
21
- ```
22
-
23
- ### 2. Stage Changes
24
- ```bash
25
- git add .
26
- ```
27
-
28
- ### 3. Run Review
29
- ```bash
30
- # Standard review (staged changes)
31
- jstar review
32
-
33
- # Retroactive (already committed)
34
- jstar review --last
35
-
36
- # Branch/PR review (against main)
37
- jstar review --pr
38
- ```
39
-
40
- ## Fix Loop Protocol
41
-
42
- 1. **Read Output**: Check `.jstar/last-review.md` or console
43
- 2. **Prioritize**: Focus on **P0_CRITICAL** and **P1_HIGH** only
44
- 3. **Loop Strategy**:
45
- - If P0/P1 found → Fix → Stage → Re-review
46
- - If only P2_MEDIUM → Consider "Good Enough"
47
- - **MAX LOOPS: 3** — If issues persist, stop and ask user
48
-
49
- ## Handling False Positives (Headless Mode)
50
-
51
- ```bash
52
- # Start headless session
53
- jstar chat --headless
54
-
55
- # List issues
56
- echo '{"action": "list"}' | jstar chat --headless
57
-
58
- # Debate an issue
59
- echo '{"action": "debate", "issueId": 0, "argument": "This is correct because..."}' | jstar chat --headless
60
-
61
- # Exit
62
- echo '{"action": "exit"}' | jstar chat --headless
63
- ```
64
-
65
- ## AI Fix Cycle
66
- ```
67
- 1. jstar review --json → Parse findings
68
- 2. Apply code fixes
69
- 3. git add . → Stage changes
70
- 4. jstar init → Update brain (if new files added)
71
- 5. jstar review --json → Verify fixes
72
- 6. Repeat until P0/P1 = 0
73
- ```
74
-
75
- ## Headless Commands
76
- | Action | Parameters | Description |
77
- |--------|------------|-------------|
78
- | `list` | — | List all current issues |
79
- | `debate` | `issueId`, `argument` | Challenge an issue |
80
- | `ignore` | `issueId` | Mark issue as ignored |
81
- | `exit` | — | End session, get final report |
1
+ ---
2
+ name: code-review
3
+ description: Deprecated compatibility alias for J-Star Reviewer. Use `jstar-reviewer` for the canonical install, review, audit, and automation flows.
4
+ ---
5
+
6
+ # Code Review (Deprecated)
7
+
8
+ This skill is kept only for backward compatibility with older Takomi prompts and habits.
9
+
10
+ Use `jstar-reviewer` as the canonical skill for:
11
+ - installing the `jstar-reviewer` npm package
12
+ - setting up `.jstar/`, `.env.local`, and `.gitignore`
13
+ - running `review` and `audit`
14
+ - using `--json` and `chat --headless` automation flows
15
+
16
+ ## Redirect Rule
17
+
18
+ If this skill is invoked, treat it as a redirect to `jstar-reviewer`.
19
+
20
+ Do not use this file as the authoritative J-Star workflow documentation.
21
+
22
+ ## Operational Rule
23
+
24
+ `review` and `audit` are separate steps.
25
+
26
+ If the user wants a serious verification pass, run both:
27
+ 1. `review` for code review findings and fix prompts
28
+ 2. `audit` for deterministic security audit findings
29
+
30
+ ## Canonical References
31
+
32
+ - `assets/.agent/skills/jstar-reviewer/SKILL.md`
33
+ - `assets/.agent/workflows/spawn-jstar-code-review.md`
34
+ - `assets/.agent/workflows/review_code.md`
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: jstar-reviewer
3
+ description: Install, configure, and use the J-Star Reviewer npm package. Use when a user wants to set up J-Star in a repository, publish or consume the npm package, initialize the local index, run the project review flow, run the separate security audit flow, or operate J-Star through JSON/headless commands.
4
+ ---
5
+
6
+ # J-Star Reviewer
7
+
8
+ ## When to Use
9
+
10
+ Use this skill when the user wants to:
11
+ - install J-Star from npm in any repository
12
+ - set up `.env.local`, `.jstar/`, and `.gitignore`
13
+ - initialize or refresh the local code index
14
+ - run `review` and `audit` as separate required steps
15
+ - use J-Star in automation with `--json` or `--headless`
16
+ - validate the package repo before publishing to npm
17
+
18
+ ## Core Rule
19
+
20
+ `review` and `audit` are separate steps.
21
+
22
+ If the user is serious about a change set, run both:
23
+ 1. `review` for hybrid deterministic + LLM code review
24
+ 2. `audit` for deterministic security audit
25
+
26
+ Do not present one as a substitute for the other.
27
+
28
+ ## Command Prefix
29
+
30
+ Pick one command prefix and use it consistently for the rest of the session:
31
+
32
+ - Global install: `jstar`
33
+ - One-off npm usage: `npx jstar-reviewer`
34
+ - Package repo development: `pnpm run`
35
+
36
+ Examples below use `<cmd>` for the global or `npx` forms.
37
+
38
+ ## Consumer Install Flow
39
+
40
+ Use this in a repository that wants to consume the published npm package.
41
+
42
+ ### 1. Prerequisites
43
+
44
+ - Node.js 18+
45
+ - Git repository
46
+ - Gemini API key
47
+ - Groq API key
48
+
49
+ ### 2. Install
50
+
51
+ Preferred:
52
+
53
+ ```bash
54
+ pnpm add -g jstar-reviewer
55
+ ```
56
+
57
+ Fallback:
58
+
59
+ ```bash
60
+ npm install -g jstar-reviewer
61
+ ```
62
+
63
+ No global install:
64
+
65
+ ```bash
66
+ npx jstar-reviewer --help
67
+ ```
68
+
69
+ ### 3. Set up the repo
70
+
71
+ ```bash
72
+ <cmd> setup
73
+ ```
74
+
75
+ This should create or update:
76
+ - `.jstar/`
77
+ - `.env.example`
78
+ - `.gitignore`
79
+
80
+ ### 4. Create `.env.local`
81
+
82
+ PowerShell:
83
+
84
+ ```powershell
85
+ Copy-Item .env.example .env.local
86
+ ```
87
+
88
+ POSIX shell:
89
+
90
+ ```bash
91
+ cp .env.example .env.local
92
+ ```
93
+
94
+ Required variables:
95
+
96
+ ```env
97
+ GEMINI_API_KEY=your_gemini_key
98
+ GROQ_API_KEY=your_groq_key
99
+ ```
100
+
101
+ Optional but useful:
102
+
103
+ ```env
104
+ GEMINI_EMBEDDING_MODEL=gemini-embedding-001
105
+ REVIEW_MODEL_NAME=moonshotai/kimi-k2-instruct-0905
106
+ ```
107
+
108
+ ### 5. Build the local index
109
+
110
+ ```bash
111
+ <cmd> init
112
+ ```
113
+
114
+ If indexing fails with a Google 404 for an embedding model, use:
115
+
116
+ ```env
117
+ GEMINI_EMBEDDING_MODEL=gemini-embedding-001
118
+ ```
119
+
120
+ ## Maintainer Flow
121
+
122
+ Use this inside the `jstar-reviewer` package repo itself before publishing.
123
+
124
+ ```bash
125
+ pnpm install
126
+ pnpm build
127
+ pnpm test
128
+ pnpm run index:init
129
+ pnpm run audit --json
130
+ ```
131
+
132
+ If you need to test the interactive review path inside the package repo:
133
+
134
+ ```bash
135
+ git add .
136
+ pnpm run review
137
+ ```
138
+
139
+ ## Required Usage Flow
140
+
141
+ ### Before commit or push
142
+
143
+ ```bash
144
+ git add .
145
+ <cmd> review
146
+ <cmd> audit
147
+ ```
148
+
149
+ ### After the commit already exists
150
+
151
+ ```bash
152
+ <cmd> review --last
153
+ <cmd> audit --last
154
+ ```
155
+
156
+ ### Branch or PR scope
157
+
158
+ ```bash
159
+ <cmd> review --pr
160
+ <cmd> audit --pr
161
+ ```
162
+
163
+ ## Review Commands
164
+
165
+ Main review targets:
166
+
167
+ ```bash
168
+ <cmd> review
169
+ <cmd> review --last
170
+ <cmd> review --commit <hash>
171
+ <cmd> review --range <start> <end>
172
+ <cmd> review --pr
173
+ <cmd> review --pr --base <branch>
174
+ ```
175
+
176
+ Review outputs:
177
+ - `.jstar/last-review.md`
178
+ - `.jstar/session.json`
179
+
180
+ ## Audit Commands
181
+
182
+ Main audit targets:
183
+
184
+ ```bash
185
+ <cmd> audit
186
+ <cmd> audit --path src
187
+ <cmd> audit --last
188
+ <cmd> audit --commit <hash>
189
+ <cmd> audit --range <start> <end>
190
+ <cmd> audit --pr
191
+ <cmd> audit --pr --base <branch>
192
+ ```
193
+
194
+ Audit outputs:
195
+ - `.jstar/audit_report.md`
196
+ - `.jstar/audit_report.json`
197
+
198
+ False positives are handled with:
199
+ - `.jstar/audit-ignore.json`
200
+
201
+ ## Automation Mode
202
+
203
+ For machine-readable review output:
204
+
205
+ ```bash
206
+ <cmd> review --json
207
+ <cmd> audit --json
208
+ ```
209
+
210
+ For issue debate:
211
+
212
+ ```bash
213
+ <cmd> chat --headless
214
+ ```
215
+
216
+ Headless commands:
217
+ - `{"action":"list"}`
218
+ - `{"action":"debate","issueId":0,"argument":"..."}`
219
+ - `{"action":"ignore","issueId":0}`
220
+ - `{"action":"accept","issueId":0}`
221
+ - `{"action":"exit"}`
222
+
223
+ ## Decision Rules for the AI
224
+
225
+ - If the repo is missing `.jstar/storage`, run `init` before `review`.
226
+ - If the user asks for a serious verification pass, run both `review` and `audit`.
227
+ - If the user only wants deterministic security checks, run `audit`.
228
+ - If the user only wants code-review findings and fix prompts on a diff, run `review`.
229
+ - If `review` says there are no staged changes, either stage files or switch to `--last`, `--range`, or `--pr`.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "J-Star Reviewer"
3
+ short_description: "Install and run J-Star review and audit"
4
+ default_prompt: "Use $jstar-reviewer to install J-Star in this repository and run both the review and audit flows."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: takomi
3
+ description: Unified Takomi protocol skill for Codex. Routes natural-language requests to built-in workflow playbooks in this skill folder (no slash commands required).
4
+ ---
5
+
6
+ # Takomi (Unified Skill)
7
+
8
+ This single skill contains the full non-legacy Takomi workflow suite.
9
+ Use it whenever a user says "use takomi", asks for Vibe Code lifecycle execution, or references any prior workflow names.
10
+
11
+ ## How To Use
12
+ - Natural language is primary. Slash commands are optional and not required.
13
+ - Examples:
14
+ - `use takomi`
15
+ - `use takomi genesis`
16
+ - `run vibe genesis`
17
+ - `continue build with takomi`
18
+
19
+ ## Router Behavior
20
+ 1. Match user intent to one workflow playbook from `workflows/`.
21
+ 2. Execute that playbook's protocol.
22
+ 3. Recommend the next workflow stage after completion.
23
+ 4. Allow explicit user overrides (guided gates, not hard blocks).
24
+
25
+ ## Lifecycle Gates
26
+ - Discover/Prime: `vibe-primeAgent.md`, `reverse_genesis.md`
27
+ - Plan/Design: `vibe-genesis.md`, `vibe-design.md`, `mode-architect.md`, `mode-visionary.md`
28
+ - Build/Continue: `vibe-build.md`, `vibe-continueBuild.md`, `mode-code.md`, `stitch.md`, `remotion-build.md`
29
+ - Review/Finalize: `mode-review.md`, `review_code.md`, `vibe-finalize.md`, `vibe-syncDocs.md`
30
+ - Recovery/Migration: `agent_reset.md`, `escalate.md`, `migrate.md`, `optimize-agent-context.md`, `mode-orchestrator.md`, `mode-debug.md`, `mode-ask.md`, `vibe-spawnTask.md`, `spawn-jstar-code-review.md`
31
+
32
+ ## Workflow Playbooks (Contained In This Skill)
33
+ - `workflows/vibe-genesis.md`
34
+ - `workflows/vibe-design.md`
35
+ - `workflows/vibe-build.md`
36
+ - `workflows/vibe-continueBuild.md`
37
+ - `workflows/vibe-finalize.md`
38
+ - `workflows/vibe-primeAgent.md`
39
+ - `workflows/vibe-spawnTask.md`
40
+ - `workflows/vibe-syncDocs.md`
41
+ - `workflows/reverse_genesis.md`
42
+ - `workflows/mode-orchestrator.md`
43
+ - `workflows/mode-architect.md`
44
+ - `workflows/mode-code.md`
45
+ - `workflows/mode-debug.md`
46
+ - `workflows/mode-ask.md`
47
+ - `workflows/mode-review.md`
48
+ - `workflows/mode-visionary.md`
49
+ - `workflows/review_code.md`
50
+ - `workflows/spawn-jstar-code-review.md`
51
+ - `workflows/agent_reset.md`
52
+ - `workflows/escalate.md`
53
+ - `workflows/migrate.md`
54
+ - `workflows/optimize-agent-context.md`
55
+ - `workflows/stitch.md`
56
+ - `workflows/remotion-build.md`
57
+
58
+ ## Alias Map
59
+ See [references/migration-map.md](references/migration-map.md).
@@ -0,0 +1,28 @@
1
+ # Takomi Alias Map (Unified Skill)
2
+
3
+ | User phrase | Internal playbook |
4
+ |---|---|
5
+ | `vibe genesis`, `takomi genesis` | `workflows/vibe-genesis.md` |
6
+ | `vibe design`, `takomi design` | `workflows/vibe-design.md` |
7
+ | `vibe build`, `takomi build` | `workflows/vibe-build.md` |
8
+ | `continue build`, `takomi continue build` | `workflows/vibe-continueBuild.md` |
9
+ | `finalize`, `takomi finalize` | `workflows/vibe-finalize.md` |
10
+ | `prime agent`, `takomi prime` | `workflows/vibe-primeAgent.md` |
11
+ | `spawn task`, `takomi spawn task` | `workflows/vibe-spawnTask.md` |
12
+ | `sync docs`, `takomi sync docs` | `workflows/vibe-syncDocs.md` |
13
+ | `reverse genesis` | `workflows/reverse_genesis.md` |
14
+ | `mode orchestrator` | `workflows/mode-orchestrator.md` |
15
+ | `mode architect` | `workflows/mode-architect.md` |
16
+ | `mode code` | `workflows/mode-code.md` |
17
+ | `mode debug` | `workflows/mode-debug.md` |
18
+ | `mode ask` | `workflows/mode-ask.md` |
19
+ | `mode review` | `workflows/mode-review.md` |
20
+ | `mode visionary` | `workflows/mode-visionary.md` |
21
+ | `review code` | `workflows/review_code.md` |
22
+ | `spawn jstar code review` | `workflows/spawn-jstar-code-review.md` |
23
+ | `agent reset` | `workflows/agent_reset.md` |
24
+ | `escalate` | `workflows/escalate.md` |
25
+ | `migrate` | `workflows/migrate.md` |
26
+ | `optimize context` | `workflows/optimize-agent-context.md` |
27
+ | `stitch` | `workflows/stitch.md` |
28
+ | `remotion build` | `workflows/remotion-build.md` |
@@ -0,0 +1,173 @@
1
+ ---
2
+ description: Mid-conversation reset to prevent hallucination and malformed edits in long context
3
+ ---
4
+
5
+ # 🧠 Agent Reset Protocol
6
+
7
+ > **TRIGGER THIS WORKFLOW** when the conversation gets long, the agent starts making mistakes, or before critical edits.
8
+
9
+ ---
10
+
11
+ ## 🛑 HARD STOP - READ THIS FIRST
12
+
13
+ You are exhibiting context degradation. Before doing ANYTHING:
14
+
15
+ 1. **STOP THINKING. START DOING.** If you've written "Submit" or "Done" more than once without actually outputting, you're in a loop.
16
+ 2. **ONE ACTION PER TURN.** Pick ONE thing to do. Do it. Wait for feedback.
17
+ 3. **NO INTERNAL MONOLOGUE.** If you catch yourself writing "(Wait, I should...)" - STOP. That's a loop symptom.
18
+ 4. **READ BEFORE EDIT. ALWAYS.**
19
+
20
+ ---
21
+
22
+ ### 0. Re-Discover Available Skills & Workflows
23
+
24
+ You may have forgotten what tools are available.
25
+
26
+ **Your system prompt lists all available skills and workflows with their full absolute paths.** Check there FIRST.
27
+
28
+ Fallback (if not in system prompt):
29
+ ```bash
30
+ ls .agent/skills/ 2>/dev/null
31
+ ls .agent/workflows/ 2>/dev/null
32
+ ```
33
+
34
+ If the user's current task matches a skill (e.g., "AI SDK", "code review", "SEO", "YouTube"), **read that skill's SKILL.md immediately**.
35
+
36
+ ---
37
+
38
+ ### 0.5. Verification Protocol (TypeScript Projects)
39
+
40
+ If this is a TypeScript project, run a health check:
41
+
42
+ ```bash
43
+ # Check current state
44
+ npx tsc --noEmit
45
+ ```
46
+
47
+ **If this fails:** You have existing type errors. Fix them before making new changes.
48
+
49
+ ```bash
50
+ # Quick verification (optional)
51
+ python scripts/vibe-verify.py --quick 2>/dev/null
52
+ ```
53
+
54
+ ---
55
+
56
+ ### 0.6. Load Project Context
57
+
58
+ If `docs/` exists, reload the project brain:
59
+
60
+ ```bash
61
+ # Coding Guidelines (The Law)
62
+ cat docs/Coding_Guidelines.md 2>/dev/null
63
+
64
+ # Current work in progress
65
+ ls docs/issues/ 2>/dev/null
66
+
67
+ # Check which FR is incomplete
68
+ grep -l "\- \[ \]" docs/issues/*.md 2>/dev/null | head -3
69
+ ```
70
+
71
+ **State the current FR:** "I am working on FR-XXX: [Title]"
72
+
73
+ ---
74
+
75
+ You are exhibiting signs of context degradation. Before continuing:
76
+
77
+ ### 1. Mandatory Pre-Edit Checklist
78
+
79
+ ```
80
+ □ Did I READ the target file with `view_file` BEFORE editing?
81
+ □ Did I copy the EXACT target content, including whitespace?
82
+ □ Am I editing LESS than 50 lines at a time?
83
+ □ Did I verify all variable names I'm using actually exist in scope?
84
+ □ Did I check that all props I'm using are destructured in the function signature?
85
+ ```
86
+
87
+ ### 2. Common Hallucination Patterns to Avoid
88
+
89
+ | Pattern | What Goes Wrong | Fix |
90
+ |---------|-----------------|-----|
91
+ | **Duplicate lines** | Pasting same useState twice | Read file first, count state declarations |
92
+ | **Missing destructuring** | Using `onInsert` without extracting from props | Check function(props) signature matches usage |
93
+ | **Broken JSX** | Mismatched tags, random `</Card >` | Always close tags in same edit block |
94
+ | **Phantom variables** | Using variables that don't exist | Ctrl+F in file before using any name |
95
+ | **Edit offset drift** | Line numbers shift after edits | Re-read file after each edit |
96
+
97
+ ### 3. File Edit Protocol
98
+
99
+ **BEFORE ANY EDIT:**
100
+ ```
101
+ 1. view_file_outline → Understand structure
102
+ 2. view_file (exact line range) → Copy PRECISE target content
103
+ 3. Make edit with MINIMAL scope
104
+ 4. Re-check file if making another edit
105
+ ```
106
+
107
+ **NEVER:**
108
+ - Edit multiple non-contiguous sections without re-reading
109
+ - Guess at indentation or whitespace
110
+ - Add variables without checking they exist
111
+ - Declare "done" without verifying lint errors are gone
112
+
113
+ ### 4. Panic Recovery
114
+
115
+ If you made a mistake:
116
+
117
+ 1. **DO NOT PANIC.** Errors are fixable.
118
+ 2. **STOP making more edits.** Each edit on broken code makes it worse.
119
+ 3. **Read the current file state** with `view_file`
120
+ 4. **Identify the EXACT problem** (duplicate line? missing import? wrong scope?)
121
+ 5. **Fix ONE thing at a time**
122
+
123
+ ### 5. Verified Completion Protocol (The "Vibe Check")
124
+
125
+ Before saying "I'm done", you MUST run this final audit:
126
+
127
+ #### A. The "Anti-Slop" Syntax Check
128
+ If the project uses TypeScript, you **MUST** run the compiler. Do not guess.
129
+ ```bash
130
+ npx tsc --noEmit
131
+ ```
132
+ *If this command fails, you are NOT done. Fix the errors.*
133
+
134
+ #### B. The "Double Vision" Check
135
+ Re-read the files you just edited (`view_file`).
136
+ - [ ] Are there duplicate variable declarations? (e.g., `const prompt` defined twice?)
137
+ - [ ] Did I accidentally paste the same code block twice?
138
+ - [ ] Are there unused imports or missing imports?
139
+
140
+ #### C. The "Task Alignment" Check
141
+ Scroll up to the user's original request.
142
+ - [ ] Did I actually solve the core problem?
143
+ - [ ] Did I introduce any regressions?
144
+ - [ ] **Lint Free?** -> `tsc` said 0 errors.
145
+
146
+ Only when all 3 checks pass can you call `notify_user`.
147
+
148
+ ---
149
+
150
+ ## 📋 Quick Copy-Paste Reminder
151
+
152
+ Add this to your prompts when the agent is misbehaving:
153
+
154
+ ```
155
+ MANDATORY:
156
+ 1. Use view_file BEFORE every edit to get EXACT current content
157
+ 2. Fix ONE error at a time, then re-read the file
158
+ 3. Verify all variables/props exist before using them
159
+ 4. Check @[current_problems] before declaring done
160
+ 5. DO NOT PANIC if you make errors - read, understand, fix methodically
161
+ ```
162
+
163
+ ---
164
+
165
+ ## 🎯 Why This Happens
166
+
167
+ Long conversations cause:
168
+ - **Attention drift** - Agent forgets earlier code structure
169
+ - **Token pressure** - Summarization loses exact details
170
+ - **Confirmation bias** - Agent "remembers" code that doesn't exist
171
+ - **Panic loops** - Error triggers more hasty edits
172
+
173
+ **The fix is always: SLOW DOWN, READ FIRST, EDIT SMALL.**