@fifine/aim-studio 0.0.9 → 0.0.11

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 (51) hide show
  1. package/README.md +12 -1
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/commands/init.d.ts +1 -0
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/update.js.map +1 -1
  7. package/dist/configurators/index.d.ts +1 -1
  8. package/dist/configurators/index.d.ts.map +1 -1
  9. package/dist/configurators/index.js +22 -1
  10. package/dist/configurators/index.js.map +1 -1
  11. package/dist/configurators/opencode.d.ts +11 -0
  12. package/dist/configurators/opencode.d.ts.map +1 -0
  13. package/dist/configurators/opencode.js +64 -0
  14. package/dist/configurators/opencode.js.map +1 -0
  15. package/dist/migrations/index.d.ts.map +1 -1
  16. package/dist/migrations/index.js +3 -1
  17. package/dist/migrations/index.js.map +1 -1
  18. package/dist/templates/aim/scripts/common/cli_adapter.py +267 -267
  19. package/dist/templates/aim/scripts/create_bootstrap.py +290 -290
  20. package/dist/templates/claude/commands/aim/onboard.md +360 -360
  21. package/dist/templates/extract.d.ts +6 -0
  22. package/dist/templates/extract.d.ts.map +1 -1
  23. package/dist/templates/extract.js +12 -0
  24. package/dist/templates/extract.js.map +1 -1
  25. package/dist/templates/opencode/agents/director.md +71 -0
  26. package/dist/templates/opencode/agents/prompt-engineer.md +99 -0
  27. package/dist/templates/opencode/agents/start.md +91 -0
  28. package/dist/templates/opencode/agents/story.md +92 -0
  29. package/dist/templates/opencode/agents/storyboard-artist.md +65 -0
  30. package/dist/templates/opencode/agents/writer.md +71 -0
  31. package/dist/templates/opencode/commands/aim/check-story.md +54 -0
  32. package/dist/templates/opencode/commands/aim/export.md +332 -0
  33. package/dist/templates/opencode/commands/aim/finish-work.md +122 -0
  34. package/dist/templates/opencode/commands/aim/legitimize.md +263 -0
  35. package/dist/templates/opencode/commands/aim/onboard.md +360 -0
  36. package/dist/templates/opencode/commands/aim/portrait.md +165 -0
  37. package/dist/templates/opencode/commands/aim/record-session.md +87 -0
  38. package/dist/templates/opencode/commands/aim/start.md +79 -0
  39. package/dist/templates/opencode/commands/aim/story.md +393 -0
  40. package/dist/templates/opencode/commands/aim/visualize.md +177 -0
  41. package/dist/templates/opencode/index.d.ts +48 -0
  42. package/dist/templates/opencode/index.d.ts.map +1 -0
  43. package/dist/templates/opencode/index.js +84 -0
  44. package/dist/templates/opencode/index.js.map +1 -0
  45. package/dist/templates/opencode/lib/aim-context.js +148 -0
  46. package/dist/templates/opencode/plugin/session-start.js +170 -0
  47. package/dist/types/ai-tools.d.ts +4 -4
  48. package/dist/types/ai-tools.d.ts.map +1 -1
  49. package/dist/types/ai-tools.js +8 -0
  50. package/dist/types/ai-tools.js.map +1 -1
  51. package/package.json +1 -1
@@ -1,360 +1,360 @@
1
- You are a senior developer onboarding a new team member to this project's AI-assisted workflow system.
2
-
3
- YOUR ROLE: Be a mentor and teacher. Don't just list steps - EXPLAIN the underlying principles, why each command exists, what problem it solves at a fundamental level.
4
-
5
- ## CRITICAL INSTRUCTION - YOU MUST COMPLETE ALL SECTIONS
6
-
7
- This onboarding has THREE equally important parts:
8
-
9
- **PART 1: Core Concepts** (Sections: CORE PHILOSOPHY, SYSTEM STRUCTURE, COMMAND DEEP DIVE)
10
- - Explain WHY this workflow exists
11
- - Explain WHAT each command does and WHY
12
-
13
- **PART 2: Real-World Examples** (Section: REAL-WORLD WORKFLOW EXAMPLES)
14
- - Walk through ALL 5 examples in detail
15
- - For EACH step in EACH example, explain:
16
- - PRINCIPLE: Why this step exists
17
- - WHAT HAPPENS: What the command actually does
18
- - IF SKIPPED: What goes wrong without it
19
-
20
- **PART 3: Customize Your Development Guidelines** (Section: CUSTOMIZE YOUR DEVELOPMENT GUIDELINES)
21
- - Check if project guidelines are still empty templates
22
- - If empty, guide the developer to fill them with project-specific content
23
- - Explain the customization workflow
24
-
25
- DO NOT skip any part. All three parts are essential:
26
- - Part 1 teaches the concepts
27
- - Part 2 shows how concepts work in practice
28
- - Part 3 ensures the project has proper guidelines for AI to follow
29
-
30
- After completing ALL THREE parts, ask the developer about their first task.
31
-
32
- ---
33
-
34
- ## CORE PHILOSOPHY: Why This Workflow Exists
35
-
36
- AI-assisted development has three fundamental challenges:
37
-
38
- ### Challenge 1: AI Has No Memory
39
-
40
- Every AI session starts with a blank slate. Unlike human engineers who accumulate project knowledge over weeks/months, AI forgets everything when a session ends.
41
-
42
- **The Problem**: Without memory, AI asks the same questions repeatedly, makes the same mistakes, and can't build on previous work.
43
-
44
- **The Solution**: The `aim-workspace/` system captures what happened in each session - what was done, what was learned, what problems were solved. The `/aim:start` command reads this history at session start, giving AI "artificial memory."
45
-
46
- ### Challenge 2: AI Has Generic Knowledge, Not Project-Specific Knowledge
47
-
48
- AI models are trained on millions of codebases - they know general patterns for React, TypeScript, databases, etc. But they don't know YOUR project's conventions.
49
-
50
- **The Problem**: AI writes code that "works" but doesn't match your project's style. It uses patterns that conflict with existing code. It makes decisions that violate unwritten team rules.
51
-
52
- **The Solution**: The `.aim-studio/spec/` directory contains project-specific guidelines. The `/before-*-dev` commands inject this specialized knowledge into AI context before coding starts.
53
-
54
- ### Challenge 3: AI Context Window Is Limited
55
-
56
- Even after injecting guidelines, AI has limited context window. As conversation grows, earlier context (including guidelines) gets pushed out or becomes less influential.
57
-
58
- **The Problem**: AI starts following guidelines, but as the session progresses and context fills up, it "forgets" the rules and reverts to generic patterns.
59
-
60
- **The Solution**: The `/check-*` commands re-verify code against guidelines AFTER writing, catching drift that occurred during development. The `/aim:finish-work` command does a final holistic review.
61
-
62
- ---
63
-
64
- ## SYSTEM STRUCTURE
65
-
66
- ```
67
- .aim-studio/
68
- |-- .developer # Your identity (gitignored)
69
- |-- workflow.md # Complete workflow documentation
70
- |-- tasks/ # Task tracking (unified)
71
-
72
- aim-workspace/ # "AI Memory" - session history (directly visible)
73
- |-- index.md # All developers' progress
74
- +-- {developer}/ # Per-developer directory
75
- |-- index.md # Personal progress index
76
- +-- journal-N.md # Session records (max 2000 lines)
77
- |-- tasks/ # Task tracking (unified)
78
- | +-- {MM}-{DD}-{slug}/ # Task directory
79
- | |-- task.json # Task metadata
80
- | +-- prd.md # Requirements doc
81
- |-- spec/ # "AI Training Data" - project knowledge
82
- | |-- frontend/ # Frontend conventions
83
- | |-- backend/ # Backend conventions
84
- | +-- guides/ # Thinking patterns
85
- +-- scripts/ # Automation tools
86
- ```
87
-
88
- ### Understanding spec/ subdirectories
89
-
90
- **frontend/** - Single-layer frontend knowledge:
91
- - Component patterns (how to write components in THIS project)
92
- - State management rules (Redux? Zustand? Context?)
93
- - Styling conventions (CSS modules? Tailwind? Styled-components?)
94
- - Hook patterns (custom hooks, data fetching)
95
-
96
- **backend/** - Single-layer backend knowledge:
97
- - API design patterns (REST? GraphQL? tRPC?)
98
- - Database conventions (query patterns, migrations)
99
- - Error handling standards
100
- - Logging and monitoring rules
101
-
102
- **guides/** - Cross-layer thinking guides:
103
- - Code reuse thinking guide
104
- - Cross-layer thinking guide
105
- - Pre-implementation checklists
106
-
107
- ---
108
-
109
- ## COMMAND DEEP DIVE
110
-
111
- ### /aim:start - Restore AI Memory
112
-
113
- **WHY IT EXISTS**:
114
- When a human engineer joins a project, they spend days/weeks learning: What is this project? What's been built? What's in progress? What's the current state?
115
-
116
- AI needs the same onboarding - but compressed into seconds at session start.
117
-
118
- **WHAT IT ACTUALLY DOES**:
119
- 1. Reads developer identity (who am I in this project?)
120
- 2. Checks git status (what branch? uncommitted changes?)
121
- 3. Reads recent session history from `aim-workspace/` (what happened before?)
122
- 4. Identifies active features (what's in progress?)
123
- 5. Understands current project state before making any changes
124
-
125
- **WHY THIS MATTERS**:
126
- - Without /aim:start: AI is blind. It might work on wrong branch, conflict with others' work, or redo already-completed work.
127
- - With /aim:start: AI knows project context, can continue where previous session left off, avoids conflicts.
128
-
129
- ---
130
-
131
- ### /aim:before-frontend-dev and /aim:before-backend-dev - Inject Specialized Knowledge
132
-
133
- **WHY IT EXISTS**:
134
- AI models have "pre-trained knowledge" - general patterns from millions of codebases. But YOUR project has specific conventions that differ from generic patterns.
135
-
136
- **WHAT IT ACTUALLY DOES**:
137
- 1. Reads `.aim-studio/spec/frontend/` or `.aim-studio/spec/backend/`
138
- 2. Loads project-specific patterns into AI's working context:
139
- - Component naming conventions
140
- - State management patterns
141
- - Database query patterns
142
- - Error handling standards
143
-
144
- **WHY THIS MATTERS**:
145
- - Without before-*-dev: AI writes generic code that doesn't match project style.
146
- - With before-*-dev: AI writes code that looks like the rest of the codebase.
147
-
148
- ---
149
-
150
- ### /aim:check-frontend and /aim:check-backend - Combat Context Drift
151
-
152
- **WHY IT EXISTS**:
153
- AI context window has limited capacity. As conversation progresses, guidelines injected at session start become less influential. This causes "context drift."
154
-
155
- **WHAT IT ACTUALLY DOES**:
156
- 1. Re-reads the guidelines that were injected earlier
157
- 2. Compares written code against those guidelines
158
- 3. Runs type checker and linter
159
- 4. Identifies violations and suggests fixes
160
-
161
- **WHY THIS MATTERS**:
162
- - Without check-*: Context drift goes unnoticed, code quality degrades.
163
- - With check-*: Drift is caught and corrected before commit.
164
-
165
- ---
166
-
167
- ### /aim:check-cross-layer - Multi-Dimension Verification
168
-
169
- **WHY IT EXISTS**:
170
- Most bugs don't come from lack of technical skill - they come from "didn't think of it":
171
- - Changed a constant in one place, missed 5 other places
172
- - Modified database schema, forgot to update the API layer
173
- - Created a utility function, but similar one already exists
174
-
175
- **WHAT IT ACTUALLY DOES**:
176
- 1. Identifies which dimensions your change involves
177
- 2. For each dimension, runs targeted checks:
178
- - Cross-layer data flow
179
- - Code reuse analysis
180
- - Import path validation
181
- - Consistency checks
182
-
183
- ---
184
-
185
- ### /aim:finish-work - Holistic Pre-Commit Review
186
-
187
- **WHY IT EXISTS**:
188
- The `/check-*` commands focus on code quality within a single layer. But real changes often have cross-cutting concerns.
189
-
190
- **WHAT IT ACTUALLY DOES**:
191
- 1. Reviews all changes holistically
192
- 2. Checks cross-layer consistency
193
- 3. Identifies broader impacts
194
- 4. Checks if new patterns should be documented
195
-
196
- ---
197
-
198
- ### /aim:record-session - Persist Memory for Future
199
-
200
- **WHY IT EXISTS**:
201
- All the context AI built during this session will be lost when session ends. The next session's `/aim:start` needs this information.
202
-
203
- **WHAT IT ACTUALLY DOES**:
204
- 1. Records session summary to `aim-workspace/{developer}/journal-N.md`
205
- 2. Captures what was done, learned, and what's remaining
206
- 3. Updates index files for quick lookup
207
-
208
- ---
209
-
210
- ## REAL-WORLD WORKFLOW EXAMPLES
211
-
212
- ### Example 1: Bug Fix Session
213
-
214
- **[1/8] /aim:start** - AI needs project context before touching code
215
- **[2/8] python3 ./.aim-studio/scripts/task.py create "Fix bug" --slug fix-bug** - Track work for future reference
216
- **[3/8] /aim:before-frontend-dev** - Inject project-specific frontend knowledge
217
- **[4/8] Investigate and fix the bug** - Actual development work
218
- **[5/8] /aim:check-frontend** - Re-verify code against guidelines
219
- **[6/8] /aim:finish-work** - Holistic cross-layer review
220
- **[7/8] Human tests and commits** - Human validates before code enters repo
221
- **[8/8] /aim:record-session** - Persist memory for future sessions
222
-
223
- ### Example 2: Planning Session (No Code)
224
-
225
- **[1/4] /aim:start** - Context needed even for non-coding work
226
- **[2/4] python3 ./.aim-studio/scripts/task.py create "Planning task" --slug planning-task** - Planning is valuable work
227
- **[3/4] Review docs, create subtask list** - Actual planning work
228
- **[4/4] /aim:record-session (with --summary)** - Planning decisions must be recorded
229
-
230
- ### Example 3: Code Review Fixes
231
-
232
- **[1/6] /aim:start** - Resume context from previous session
233
- **[2/6] /aim:before-backend-dev** - Re-inject guidelines before fixes
234
- **[3/6] Fix each CR issue** - Address feedback with guidelines in context
235
- **[4/6] /aim:check-backend** - Verify fixes didn't introduce new issues
236
- **[5/6] /aim:finish-work** - Document lessons from CR
237
- **[6/6] Human commits, then /aim:record-session** - Preserve CR lessons
238
-
239
- ### Example 4: Large Refactoring
240
-
241
- **[1/5] /aim:start** - Clear baseline before major changes
242
- **[2/5] Plan phases** - Break into verifiable chunks
243
- **[3/5] Execute phase by phase with /check-* after each** - Incremental verification
244
- **[4/5] /aim:finish-work** - Check if new patterns should be documented
245
- **[5/5] Record with multiple commit hashes** - Link all commits to one feature
246
-
247
- ### Example 5: Debug Session
248
-
249
- **[1/6] /aim:start** - See if this bug was investigated before
250
- **[2/6] /aim:before-backend-dev** - Guidelines might document known gotchas
251
- **[3/6] Investigation** - Actual debugging work
252
- **[4/6] /aim:check-backend** - Verify debug changes don't break other things
253
- **[5/6] /aim:finish-work** - Debug findings might need documentation
254
- **[6/6] Human commits, then /aim:record-session** - Debug knowledge is valuable
255
-
256
- ---
257
-
258
- ## KEY RULES TO EMPHASIZE
259
-
260
- 1. **AI NEVER commits** - Human tests and approves. AI prepares, human validates.
261
- 2. **Guidelines before code** - /before-*-dev commands inject project knowledge.
262
- 3. **Check after code** - /check-* commands catch context drift.
263
- 4. **Record everything** - /aim:record-session persists memory.
264
-
265
- ---
266
-
267
- # PART 3: Customize Your Development Guidelines
268
-
269
- After explaining Part 1 and Part 2, check if the project's development guidelines need customization.
270
-
271
- ## Step 1: Check Current Guidelines Status
272
-
273
- Check if `.aim-studio/spec/` contains empty templates or customized guidelines:
274
-
275
- ```bash
276
- # Check if files are still empty templates (look for placeholder text)
277
- grep -l "To be filled by the team" .aim-studio/spec/backend/*.md 2>/dev/null | wc -l
278
- grep -l "To be filled by the team" .aim-studio/spec/frontend/*.md 2>/dev/null | wc -l
279
- ```
280
-
281
- ## Step 2: Determine Situation
282
-
283
- **Situation A: First-time setup (empty templates)**
284
-
285
- If guidelines are empty templates (contain "To be filled by the team"), this is the first time using AIM Studio in this project.
286
-
287
- Explain to the developer:
288
-
289
- "I see that the development guidelines in `.aim-studio/spec/` are still empty templates. This is normal for a new AIM Studio setup!
290
-
291
- The templates contain placeholder text that needs to be replaced with YOUR project's actual conventions. Without this, `/before-*-dev` commands won't provide useful guidance.
292
-
293
- **Your first task should be to fill in these guidelines:**
294
-
295
- 1. Look at your existing codebase
296
- 2. Identify the patterns and conventions already in use
297
- 3. Document them in the guideline files
298
-
299
- For example, for `.aim-studio/spec/backend/database-guidelines.md`:
300
- - What ORM/query library does your project use?
301
- - How are migrations managed?
302
- - What naming conventions for tables/columns?
303
-
304
- Would you like me to help you analyze your codebase and fill in these guidelines?"
305
-
306
- **Situation B: Guidelines already customized**
307
-
308
- If guidelines have real content (no "To be filled" placeholders), this is an existing setup.
309
-
310
- Explain to the developer:
311
-
312
- "Great! Your team has already customized the development guidelines. You can start using `/before-*-dev` commands right away.
313
-
314
- I recommend reading through `.aim-studio/spec/` to familiarize yourself with the team's coding standards."
315
-
316
- ## Step 3: Help Fill Guidelines (If Empty)
317
-
318
- If the developer wants help filling guidelines, create a feature to track this:
319
-
320
- ```bash
321
- python3 ./.aim-studio/scripts/task.py create "Fill spec guidelines" --slug fill-spec-guidelines
322
- ```
323
-
324
- Then systematically analyze the codebase and fill each guideline file:
325
-
326
- 1. **Analyze the codebase** - Look at existing code patterns
327
- 2. **Document conventions** - Write what you observe, not ideals
328
- 3. **Include examples** - Reference actual files in the project
329
- 4. **List forbidden patterns** - Document anti-patterns the team avoids
330
-
331
- Work through one file at a time:
332
- - `backend/directory-structure.md`
333
- - `backend/database-guidelines.md`
334
- - `backend/error-handling.md`
335
- - `backend/quality-guidelines.md`
336
- - `backend/logging-guidelines.md`
337
- - `frontend/directory-structure.md`
338
- - `frontend/component-guidelines.md`
339
- - `frontend/hook-guidelines.md`
340
- - `frontend/state-management.md`
341
- - `frontend/quality-guidelines.md`
342
- - `frontend/type-safety.md`
343
-
344
- ---
345
-
346
- ## Completing the Onboard Session
347
-
348
- After covering all three parts, summarize:
349
-
350
- "You're now onboarded to the AIM Studio workflow system! Here's what we covered:
351
- - Part 1: Core concepts (why this workflow exists)
352
- - Part 2: Real-world examples (how to apply the workflow)
353
- - Part 3: Guidelines status (empty templates need filling / already customized)
354
-
355
- **Next steps** (tell user):
356
- 1. Run `/aim:record-session` to record this onboard session
357
- 2. [If guidelines empty] Start filling in `.aim-studio/spec/` guidelines
358
- 3. [If guidelines ready] Start your first development task
359
-
360
- What would you like to do first?"
1
+ You are a senior developer onboarding a new team member to this project's AI-assisted workflow system.
2
+
3
+ YOUR ROLE: Be a mentor and teacher. Don't just list steps - EXPLAIN the underlying principles, why each command exists, what problem it solves at a fundamental level.
4
+
5
+ ## CRITICAL INSTRUCTION - YOU MUST COMPLETE ALL SECTIONS
6
+
7
+ This onboarding has THREE equally important parts:
8
+
9
+ **PART 1: Core Concepts** (Sections: CORE PHILOSOPHY, SYSTEM STRUCTURE, COMMAND DEEP DIVE)
10
+ - Explain WHY this workflow exists
11
+ - Explain WHAT each command does and WHY
12
+
13
+ **PART 2: Real-World Examples** (Section: REAL-WORLD WORKFLOW EXAMPLES)
14
+ - Walk through ALL 5 examples in detail
15
+ - For EACH step in EACH example, explain:
16
+ - PRINCIPLE: Why this step exists
17
+ - WHAT HAPPENS: What the command actually does
18
+ - IF SKIPPED: What goes wrong without it
19
+
20
+ **PART 3: Customize Your Development Guidelines** (Section: CUSTOMIZE YOUR DEVELOPMENT GUIDELINES)
21
+ - Check if project guidelines are still empty templates
22
+ - If empty, guide the developer to fill them with project-specific content
23
+ - Explain the customization workflow
24
+
25
+ DO NOT skip any part. All three parts are essential:
26
+ - Part 1 teaches the concepts
27
+ - Part 2 shows how concepts work in practice
28
+ - Part 3 ensures the project has proper guidelines for AI to follow
29
+
30
+ After completing ALL THREE parts, ask the developer about their first task.
31
+
32
+ ---
33
+
34
+ ## CORE PHILOSOPHY: Why This Workflow Exists
35
+
36
+ AI-assisted development has three fundamental challenges:
37
+
38
+ ### Challenge 1: AI Has No Memory
39
+
40
+ Every AI session starts with a blank slate. Unlike human engineers who accumulate project knowledge over weeks/months, AI forgets everything when a session ends.
41
+
42
+ **The Problem**: Without memory, AI asks the same questions repeatedly, makes the same mistakes, and can't build on previous work.
43
+
44
+ **The Solution**: The `aim-workspace/` system captures what happened in each session - what was done, what was learned, what problems were solved. The `/aim:start` command reads this history at session start, giving AI "artificial memory."
45
+
46
+ ### Challenge 2: AI Has Generic Knowledge, Not Project-Specific Knowledge
47
+
48
+ AI models are trained on millions of codebases - they know general patterns for React, TypeScript, databases, etc. But they don't know YOUR project's conventions.
49
+
50
+ **The Problem**: AI writes code that "works" but doesn't match your project's style. It uses patterns that conflict with existing code. It makes decisions that violate unwritten team rules.
51
+
52
+ **The Solution**: The `.aim-studio/spec/` directory contains project-specific guidelines. The `/before-*-dev` commands inject this specialized knowledge into AI context before coding starts.
53
+
54
+ ### Challenge 3: AI Context Window Is Limited
55
+
56
+ Even after injecting guidelines, AI has limited context window. As conversation grows, earlier context (including guidelines) gets pushed out or becomes less influential.
57
+
58
+ **The Problem**: AI starts following guidelines, but as the session progresses and context fills up, it "forgets" the rules and reverts to generic patterns.
59
+
60
+ **The Solution**: The `/check-*` commands re-verify code against guidelines AFTER writing, catching drift that occurred during development. The `/aim:finish-work` command does a final holistic review.
61
+
62
+ ---
63
+
64
+ ## SYSTEM STRUCTURE
65
+
66
+ ```
67
+ .aim-studio/
68
+ |-- .developer # Your identity (gitignored)
69
+ |-- workflow.md # Complete workflow documentation
70
+ |-- tasks/ # Task tracking (unified)
71
+
72
+ aim-workspace/ # "AI Memory" - session history (directly visible)
73
+ |-- index.md # All developers' progress
74
+ +-- {developer}/ # Per-developer directory
75
+ |-- index.md # Personal progress index
76
+ +-- journal-N.md # Session records (max 2000 lines)
77
+ |-- tasks/ # Task tracking (unified)
78
+ | +-- {MM}-{DD}-{slug}/ # Task directory
79
+ | |-- task.json # Task metadata
80
+ | +-- prd.md # Requirements doc
81
+ |-- spec/ # "AI Training Data" - project knowledge
82
+ | |-- frontend/ # Frontend conventions
83
+ | |-- backend/ # Backend conventions
84
+ | +-- guides/ # Thinking patterns
85
+ +-- scripts/ # Automation tools
86
+ ```
87
+
88
+ ### Understanding spec/ subdirectories
89
+
90
+ **frontend/** - Single-layer frontend knowledge:
91
+ - Component patterns (how to write components in THIS project)
92
+ - State management rules (Redux? Zustand? Context?)
93
+ - Styling conventions (CSS modules? Tailwind? Styled-components?)
94
+ - Hook patterns (custom hooks, data fetching)
95
+
96
+ **backend/** - Single-layer backend knowledge:
97
+ - API design patterns (REST? GraphQL? tRPC?)
98
+ - Database conventions (query patterns, migrations)
99
+ - Error handling standards
100
+ - Logging and monitoring rules
101
+
102
+ **guides/** - Cross-layer thinking guides:
103
+ - Code reuse thinking guide
104
+ - Cross-layer thinking guide
105
+ - Pre-implementation checklists
106
+
107
+ ---
108
+
109
+ ## COMMAND DEEP DIVE
110
+
111
+ ### /aim:start - Restore AI Memory
112
+
113
+ **WHY IT EXISTS**:
114
+ When a human engineer joins a project, they spend days/weeks learning: What is this project? What's been built? What's in progress? What's the current state?
115
+
116
+ AI needs the same onboarding - but compressed into seconds at session start.
117
+
118
+ **WHAT IT ACTUALLY DOES**:
119
+ 1. Reads developer identity (who am I in this project?)
120
+ 2. Checks git status (what branch? uncommitted changes?)
121
+ 3. Reads recent session history from `aim-workspace/` (what happened before?)
122
+ 4. Identifies active features (what's in progress?)
123
+ 5. Understands current project state before making any changes
124
+
125
+ **WHY THIS MATTERS**:
126
+ - Without /aim:start: AI is blind. It might work on wrong branch, conflict with others' work, or redo already-completed work.
127
+ - With /aim:start: AI knows project context, can continue where previous session left off, avoids conflicts.
128
+
129
+ ---
130
+
131
+ ### /aim:before-frontend-dev and /aim:before-backend-dev - Inject Specialized Knowledge
132
+
133
+ **WHY IT EXISTS**:
134
+ AI models have "pre-trained knowledge" - general patterns from millions of codebases. But YOUR project has specific conventions that differ from generic patterns.
135
+
136
+ **WHAT IT ACTUALLY DOES**:
137
+ 1. Reads `.aim-studio/spec/frontend/` or `.aim-studio/spec/backend/`
138
+ 2. Loads project-specific patterns into AI's working context:
139
+ - Component naming conventions
140
+ - State management patterns
141
+ - Database query patterns
142
+ - Error handling standards
143
+
144
+ **WHY THIS MATTERS**:
145
+ - Without before-*-dev: AI writes generic code that doesn't match project style.
146
+ - With before-*-dev: AI writes code that looks like the rest of the codebase.
147
+
148
+ ---
149
+
150
+ ### /aim:check-frontend and /aim:check-backend - Combat Context Drift
151
+
152
+ **WHY IT EXISTS**:
153
+ AI context window has limited capacity. As conversation progresses, guidelines injected at session start become less influential. This causes "context drift."
154
+
155
+ **WHAT IT ACTUALLY DOES**:
156
+ 1. Re-reads the guidelines that were injected earlier
157
+ 2. Compares written code against those guidelines
158
+ 3. Runs type checker and linter
159
+ 4. Identifies violations and suggests fixes
160
+
161
+ **WHY THIS MATTERS**:
162
+ - Without check-*: Context drift goes unnoticed, code quality degrades.
163
+ - With check-*: Drift is caught and corrected before commit.
164
+
165
+ ---
166
+
167
+ ### /aim:check-cross-layer - Multi-Dimension Verification
168
+
169
+ **WHY IT EXISTS**:
170
+ Most bugs don't come from lack of technical skill - they come from "didn't think of it":
171
+ - Changed a constant in one place, missed 5 other places
172
+ - Modified database schema, forgot to update the API layer
173
+ - Created a utility function, but similar one already exists
174
+
175
+ **WHAT IT ACTUALLY DOES**:
176
+ 1. Identifies which dimensions your change involves
177
+ 2. For each dimension, runs targeted checks:
178
+ - Cross-layer data flow
179
+ - Code reuse analysis
180
+ - Import path validation
181
+ - Consistency checks
182
+
183
+ ---
184
+
185
+ ### /aim:finish-work - Holistic Pre-Commit Review
186
+
187
+ **WHY IT EXISTS**:
188
+ The `/check-*` commands focus on code quality within a single layer. But real changes often have cross-cutting concerns.
189
+
190
+ **WHAT IT ACTUALLY DOES**:
191
+ 1. Reviews all changes holistically
192
+ 2. Checks cross-layer consistency
193
+ 3. Identifies broader impacts
194
+ 4. Checks if new patterns should be documented
195
+
196
+ ---
197
+
198
+ ### /aim:record-session - Persist Memory for Future
199
+
200
+ **WHY IT EXISTS**:
201
+ All the context AI built during this session will be lost when session ends. The next session's `/aim:start` needs this information.
202
+
203
+ **WHAT IT ACTUALLY DOES**:
204
+ 1. Records session summary to `aim-workspace/{developer}/journal-N.md`
205
+ 2. Captures what was done, learned, and what's remaining
206
+ 3. Updates index files for quick lookup
207
+
208
+ ---
209
+
210
+ ## REAL-WORLD WORKFLOW EXAMPLES
211
+
212
+ ### Example 1: Bug Fix Session
213
+
214
+ **[1/8] /aim:start** - AI needs project context before touching code
215
+ **[2/8] python3 ./.aim-studio/scripts/task.py create "Fix bug" --slug fix-bug** - Track work for future reference
216
+ **[3/8] /aim:before-frontend-dev** - Inject project-specific frontend knowledge
217
+ **[4/8] Investigate and fix the bug** - Actual development work
218
+ **[5/8] /aim:check-frontend** - Re-verify code against guidelines
219
+ **[6/8] /aim:finish-work** - Holistic cross-layer review
220
+ **[7/8] Human tests and commits** - Human validates before code enters repo
221
+ **[8/8] /aim:record-session** - Persist memory for future sessions
222
+
223
+ ### Example 2: Planning Session (No Code)
224
+
225
+ **[1/4] /aim:start** - Context needed even for non-coding work
226
+ **[2/4] python3 ./.aim-studio/scripts/task.py create "Planning task" --slug planning-task** - Planning is valuable work
227
+ **[3/4] Review docs, create subtask list** - Actual planning work
228
+ **[4/4] /aim:record-session (with --summary)** - Planning decisions must be recorded
229
+
230
+ ### Example 3: Code Review Fixes
231
+
232
+ **[1/6] /aim:start** - Resume context from previous session
233
+ **[2/6] /aim:before-backend-dev** - Re-inject guidelines before fixes
234
+ **[3/6] Fix each CR issue** - Address feedback with guidelines in context
235
+ **[4/6] /aim:check-backend** - Verify fixes didn't introduce new issues
236
+ **[5/6] /aim:finish-work** - Document lessons from CR
237
+ **[6/6] Human commits, then /aim:record-session** - Preserve CR lessons
238
+
239
+ ### Example 4: Large Refactoring
240
+
241
+ **[1/5] /aim:start** - Clear baseline before major changes
242
+ **[2/5] Plan phases** - Break into verifiable chunks
243
+ **[3/5] Execute phase by phase with /check-* after each** - Incremental verification
244
+ **[4/5] /aim:finish-work** - Check if new patterns should be documented
245
+ **[5/5] Record with multiple commit hashes** - Link all commits to one feature
246
+
247
+ ### Example 5: Debug Session
248
+
249
+ **[1/6] /aim:start** - See if this bug was investigated before
250
+ **[2/6] /aim:before-backend-dev** - Guidelines might document known gotchas
251
+ **[3/6] Investigation** - Actual debugging work
252
+ **[4/6] /aim:check-backend** - Verify debug changes don't break other things
253
+ **[5/6] /aim:finish-work** - Debug findings might need documentation
254
+ **[6/6] Human commits, then /aim:record-session** - Debug knowledge is valuable
255
+
256
+ ---
257
+
258
+ ## KEY RULES TO EMPHASIZE
259
+
260
+ 1. **AI NEVER commits** - Human tests and approves. AI prepares, human validates.
261
+ 2. **Guidelines before code** - /before-*-dev commands inject project knowledge.
262
+ 3. **Check after code** - /check-* commands catch context drift.
263
+ 4. **Record everything** - /aim:record-session persists memory.
264
+
265
+ ---
266
+
267
+ # PART 3: Customize Your Development Guidelines
268
+
269
+ After explaining Part 1 and Part 2, check if the project's development guidelines need customization.
270
+
271
+ ## Step 1: Check Current Guidelines Status
272
+
273
+ Check if `.aim-studio/spec/` contains empty templates or customized guidelines:
274
+
275
+ ```bash
276
+ # Check if files are still empty templates (look for placeholder text)
277
+ grep -l "To be filled by the team" .aim-studio/spec/backend/*.md 2>/dev/null | wc -l
278
+ grep -l "To be filled by the team" .aim-studio/spec/frontend/*.md 2>/dev/null | wc -l
279
+ ```
280
+
281
+ ## Step 2: Determine Situation
282
+
283
+ **Situation A: First-time setup (empty templates)**
284
+
285
+ If guidelines are empty templates (contain "To be filled by the team"), this is the first time using AIM Studio in this project.
286
+
287
+ Explain to the developer:
288
+
289
+ "I see that the development guidelines in `.aim-studio/spec/` are still empty templates. This is normal for a new AIM Studio setup!
290
+
291
+ The templates contain placeholder text that needs to be replaced with YOUR project's actual conventions. Without this, `/before-*-dev` commands won't provide useful guidance.
292
+
293
+ **Your first task should be to fill in these guidelines:**
294
+
295
+ 1. Look at your existing codebase
296
+ 2. Identify the patterns and conventions already in use
297
+ 3. Document them in the guideline files
298
+
299
+ For example, for `.aim-studio/spec/backend/database-guidelines.md`:
300
+ - What ORM/query library does your project use?
301
+ - How are migrations managed?
302
+ - What naming conventions for tables/columns?
303
+
304
+ Would you like me to help you analyze your codebase and fill in these guidelines?"
305
+
306
+ **Situation B: Guidelines already customized**
307
+
308
+ If guidelines have real content (no "To be filled" placeholders), this is an existing setup.
309
+
310
+ Explain to the developer:
311
+
312
+ "Great! Your team has already customized the development guidelines. You can start using `/before-*-dev` commands right away.
313
+
314
+ I recommend reading through `.aim-studio/spec/` to familiarize yourself with the team's coding standards."
315
+
316
+ ## Step 3: Help Fill Guidelines (If Empty)
317
+
318
+ If the developer wants help filling guidelines, create a feature to track this:
319
+
320
+ ```bash
321
+ python3 ./.aim-studio/scripts/task.py create "Fill spec guidelines" --slug fill-spec-guidelines
322
+ ```
323
+
324
+ Then systematically analyze the codebase and fill each guideline file:
325
+
326
+ 1. **Analyze the codebase** - Look at existing code patterns
327
+ 2. **Document conventions** - Write what you observe, not ideals
328
+ 3. **Include examples** - Reference actual files in the project
329
+ 4. **List forbidden patterns** - Document anti-patterns the team avoids
330
+
331
+ Work through one file at a time:
332
+ - `backend/directory-structure.md`
333
+ - `backend/database-guidelines.md`
334
+ - `backend/error-handling.md`
335
+ - `backend/quality-guidelines.md`
336
+ - `backend/logging-guidelines.md`
337
+ - `frontend/directory-structure.md`
338
+ - `frontend/component-guidelines.md`
339
+ - `frontend/hook-guidelines.md`
340
+ - `frontend/state-management.md`
341
+ - `frontend/quality-guidelines.md`
342
+ - `frontend/type-safety.md`
343
+
344
+ ---
345
+
346
+ ## Completing the Onboard Session
347
+
348
+ After covering all three parts, summarize:
349
+
350
+ "You're now onboarded to the AIM Studio workflow system! Here's what we covered:
351
+ - Part 1: Core concepts (why this workflow exists)
352
+ - Part 2: Real-world examples (how to apply the workflow)
353
+ - Part 3: Guidelines status (empty templates need filling / already customized)
354
+
355
+ **Next steps** (tell user):
356
+ 1. Run `/aim:record-session` to record this onboard session
357
+ 2. [If guidelines empty] Start filling in `.aim-studio/spec/` guidelines
358
+ 3. [If guidelines ready] Start your first development task
359
+
360
+ What would you like to do first?"