planflow-ai 1.4.1 → 1.4.3
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.
- package/.claude/commands/brainstorm.md +6 -14
- package/.claude/commands/create-contract.md +6 -38
- package/.claude/commands/create-plan.md +7 -38
- package/.claude/commands/discovery-plan.md +7 -49
- package/.claude/commands/execute-plan.md +11 -63
- package/.claude/commands/heartbeat.md +12 -14
- package/.claude/commands/learn.md +20 -80
- package/.claude/commands/note.md +6 -23
- package/.claude/commands/review-code.md +8 -51
- package/.claude/commands/review-pr.md +10 -57
- package/.claude/commands/setup.md +8 -56
- package/.claude/commands/write-tests.md +7 -41
- package/.claude/resources/core/phase-isolation.md +46 -1
- package/.claude/resources/core/shared-context.md +110 -0
- package/.claude/resources/core/wave-execution.md +79 -1
- package/.claude/resources/skills/execute-plan-skill.md +74 -13
- package/README.md +154 -96
- package/dist/cli/commands/brain.d.ts +20 -0
- package/dist/cli/commands/brain.d.ts.map +1 -0
- package/dist/cli/commands/brain.js +127 -0
- package/dist/cli/commands/brain.js.map +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +9 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/state-query.d.ts +13 -0
- package/dist/cli/commands/state-query.d.ts.map +1 -0
- package/dist/cli/commands/state-query.js +32 -0
- package/dist/cli/commands/state-query.js.map +1 -0
- package/dist/cli/daemon/shared-context.d.ts +38 -0
- package/dist/cli/daemon/shared-context.d.ts.map +1 -0
- package/dist/cli/daemon/shared-context.js +129 -0
- package/dist/cli/daemon/shared-context.js.map +1 -0
- package/dist/cli/handlers/claude.d.ts.map +1 -1
- package/dist/cli/handlers/claude.js +18 -0
- package/dist/cli/handlers/claude.js.map +1 -1
- package/dist/cli/handlers/shared.js +1 -1
- package/dist/cli/handlers/shared.js.map +1 -1
- package/dist/cli/index.js +21 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/state/brain-query.d.ts +48 -0
- package/dist/cli/state/brain-query.d.ts.map +1 -0
- package/dist/cli/state/brain-query.js +113 -0
- package/dist/cli/state/brain-query.js.map +1 -0
- package/dist/cli/state/types.d.ts +31 -0
- package/dist/cli/state/types.d.ts.map +1 -1
- package/package.json +4 -1
- package/.claude/resources/core/_index.md +0 -347
- package/.claude/resources/languages/_index.md +0 -76
- package/.claude/resources/patterns/_index.md +0 -200
- package/.claude/resources/skills/_index.md +0 -287
- package/.claude/resources/tools/_index.md +0 -110
- package/.claude/resources/tools/reference-expansion-tool.md +0 -326
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
## Reference Code System
|
|
3
|
-
|
|
4
|
-
### Code Prefixes
|
|
5
|
-
|
|
6
|
-
| Prefix | Folder | Description |
|
|
7
|
-
|--------|--------|-------------|
|
|
8
|
-
| COR- | `rules/core/` | Core rules (allowed/forbidden patterns, complexity) |
|
|
9
|
-
| LNG- | `resources/languages/` | Language-specific patterns |
|
|
10
|
-
| PTN- | `resources/patterns/` | Pattern files (discovery, plans, tests, etc.) |
|
|
11
|
-
| SKL- | `resources/skills/` | Skill files for commands |
|
|
12
|
-
| TLS- | `resources/tools/` | Tool documentation |
|
|
13
|
-
|
|
14
|
-
### Code Format
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
[PREFIX]-[SUBCATEGORY]-[NUMBER]
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
**Examples**:
|
|
21
|
-
- `COR-1` - Core rule section 1
|
|
22
|
-
- `LNG-TS-1` - TypeScript pattern section 1
|
|
23
|
-
- `PTN-DIS-1` - Discovery pattern section 1
|
|
24
|
-
- `SKL-EXEC-1` - Execute plan skill section 1
|
|
25
|
-
- `TLS-AUTH-1` - Auth tool section 1
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Expansion Workflow
|
|
30
|
-
|
|
31
|
-
### Step 1: Load the Index
|
|
32
|
-
|
|
33
|
-
When a command or skill is invoked, load the relevant `_index.md` file:
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
docs/[folder]/_index.md
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
The index contains a table of all reference codes with descriptions.
|
|
40
|
-
|
|
41
|
-
### Step 2: Identify Needed References
|
|
42
|
-
|
|
43
|
-
Based on the current task, identify which reference codes are needed:
|
|
44
|
-
|
|
45
|
-
- Read the "When to Expand" section in the index
|
|
46
|
-
- Match the task to specific codes
|
|
47
|
-
- Only expand what's needed for the current task
|
|
48
|
-
|
|
49
|
-
### Step 3: Expand Reference Codes
|
|
50
|
-
|
|
51
|
-
Use the Read tool to load the specific line range:
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
Read file: docs/[folder]/[filename].md
|
|
55
|
-
Lines: [start]-[end]
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Step 4: Use the Content
|
|
59
|
-
|
|
60
|
-
The expanded content is now in context. Use it for the current task.
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## When to Expand vs. When to Skip
|
|
65
|
-
|
|
66
|
-
### Expand When
|
|
67
|
-
|
|
68
|
-
| Situation | Action |
|
|
69
|
-
|-----------|--------|
|
|
70
|
-
| Creating a discovery document | Expand PTN-DIS-* (discovery templates/patterns) |
|
|
71
|
-
| Writing tests | Expand PTN-JEST-* or PTN-PYTEST-* |
|
|
72
|
-
| Reviewing a PR | Expand PTN-PR-* and SKL-PR-* |
|
|
73
|
-
| Need specific example code | Expand the example section code |
|
|
74
|
-
| Following a specific pattern | Expand that pattern's section |
|
|
75
|
-
|
|
76
|
-
### Skip When
|
|
77
|
-
|
|
78
|
-
| Situation | Action |
|
|
79
|
-
|-----------|--------|
|
|
80
|
-
| Task is simple and familiar | Use index summary only |
|
|
81
|
-
| Pattern is well-known | Don't expand, just reference |
|
|
82
|
-
| Multiple sections might apply | Start with index, narrow down |
|
|
83
|
-
| Already have similar context | Don't duplicate |
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Example: Discovery Command
|
|
88
|
-
|
|
89
|
-
**Task**: Create a discovery document
|
|
90
|
-
|
|
91
|
-
**Step 1**: Load index
|
|
92
|
-
```
|
|
93
|
-
Read: resources/patterns/_index.md
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Step 2**: Identify needed codes from index
|
|
97
|
-
- PTN-DIS-1: Discovery document template
|
|
98
|
-
- PTN-DIS-2: Requirements gathering example
|
|
99
|
-
|
|
100
|
-
**Step 3**: Expand specific sections
|
|
101
|
-
```
|
|
102
|
-
Read: resources/patterns/discovery-templates.md
|
|
103
|
-
Lines: 15-80 (for PTN-DIS-1)
|
|
104
|
-
Lines: 244-279 (for PTN-DIS-2)
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Step 4**: Use templates to create the document
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Example: Execute Plan Command
|
|
112
|
-
|
|
113
|
-
**Task**: Execute an implementation plan
|
|
114
|
-
|
|
115
|
-
**Step 1**: Load indexes
|
|
116
|
-
```
|
|
117
|
-
Read: resources/skills/_index.md
|
|
118
|
-
Read: resources/core/_index.md
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Step 2**: Identify needed codes
|
|
122
|
-
- SKL-EXEC-1: Execution workflow
|
|
123
|
-
- SKL-EXEC-2: Complexity-based grouping
|
|
124
|
-
- COR-3: Complexity scoring table
|
|
125
|
-
|
|
126
|
-
**Step 3**: Expand as needed during execution
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
## Maintenance Guidelines
|
|
131
|
-
|
|
132
|
-
### When to Update Indexes
|
|
133
|
-
|
|
134
|
-
Update the relevant `_index.md` when:
|
|
135
|
-
|
|
136
|
-
1. **Adding a new section** to a source file
|
|
137
|
-
2. **Removing a section** from a source file
|
|
138
|
-
3. **Renaming a section** in a source file
|
|
139
|
-
4. **Line numbers change** significantly (after major edits)
|
|
140
|
-
|
|
141
|
-
### How to Update
|
|
142
|
-
|
|
143
|
-
1. Open the source file and identify the new/changed section
|
|
144
|
-
2. Note the line range (start line to end line)
|
|
145
|
-
3. Update the `_index.md` reference table:
|
|
146
|
-
- Add new code for new sections
|
|
147
|
-
- Update line ranges for moved sections
|
|
148
|
-
- Remove codes for deleted sections
|
|
149
|
-
|
|
150
|
-
### Best Practices
|
|
151
|
-
|
|
152
|
-
| Practice | Reason |
|
|
153
|
-
|----------|--------|
|
|
154
|
-
| Update index immediately after editing source | Prevents stale references |
|
|
155
|
-
| Use descriptive section descriptions | Helps identify correct code |
|
|
156
|
-
| Keep line ranges accurate | Ensures correct content is loaded |
|
|
157
|
-
| Review indexes periodically | Catch any drift |
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## Index File Locations
|
|
162
|
-
|
|
163
|
-
| Folder | Index Path |
|
|
164
|
-
|--------|------------|
|
|
165
|
-
| Core | `resources/core/_index.md` |
|
|
166
|
-
| Languages | `resources/languages/_index.md` |
|
|
167
|
-
| Patterns | `resources/patterns/_index.md` |
|
|
168
|
-
| Skills | `resources/skills/_index.md` |
|
|
169
|
-
| Tools | `resources/tools/_index.md` |
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## Troubleshooting
|
|
174
|
-
|
|
175
|
-
### Reference Code Not Found
|
|
176
|
-
|
|
177
|
-
If a reference code isn't in the index:
|
|
178
|
-
1. Check the prefix matches the correct folder
|
|
179
|
-
2. Verify the index file exists
|
|
180
|
-
3. The section may have been added recently - check source file
|
|
181
|
-
|
|
182
|
-
### Line Range Invalid
|
|
183
|
-
|
|
184
|
-
If the line range doesn't match expected content:
|
|
185
|
-
1. The source file was edited after index creation
|
|
186
|
-
2. Re-analyze the source file
|
|
187
|
-
3. Update the line range in the index
|
|
188
|
-
|
|
189
|
-
### Content Seems Incomplete
|
|
190
|
-
|
|
191
|
-
If expanded content is missing context:
|
|
192
|
-
1. Expand a larger line range
|
|
193
|
-
2. Include surrounding sections
|
|
194
|
-
3. Check if section references other sections
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## Adding New Reference Codes
|
|
199
|
-
|
|
200
|
-
When adding content to the project that should be indexed:
|
|
201
|
-
|
|
202
|
-
### Step 1: Create or Edit the Source File
|
|
203
|
-
|
|
204
|
-
Add your new section to the appropriate file:
|
|
205
|
-
- Core rules → `rules/core/`
|
|
206
|
-
- Language patterns → `resources/languages/`
|
|
207
|
-
- Patterns → `resources/patterns/`
|
|
208
|
-
- Skills → `resources/skills/`
|
|
209
|
-
- Tools → `resources/tools/`
|
|
210
|
-
|
|
211
|
-
### Step 2: Determine the Reference Code
|
|
212
|
-
|
|
213
|
-
Use the naming convention:
|
|
214
|
-
```
|
|
215
|
-
[PREFIX]-[SUBCATEGORY]-[NUMBER]
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
| Prefix | For Files In |
|
|
219
|
-
|--------|--------------|
|
|
220
|
-
| COR- | rules/core/ |
|
|
221
|
-
| LNG- | resources/languages/ |
|
|
222
|
-
| PTN- | resources/patterns/ |
|
|
223
|
-
| SKL- | resources/skills/ |
|
|
224
|
-
| TLS- | resources/tools/ |
|
|
225
|
-
|
|
226
|
-
### Step 3: Update the Index
|
|
227
|
-
|
|
228
|
-
Open the relevant `_index.md` file and add a new row to the reference table:
|
|
229
|
-
|
|
230
|
-
```markdown
|
|
231
|
-
| NEW-CODE-1 | 150-180 | Description of the new section |
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Step 4: Verify
|
|
235
|
-
|
|
236
|
-
1. Check the line numbers match the actual content
|
|
237
|
-
2. Ensure the description is clear and actionable
|
|
238
|
-
3. Update "When to Expand" section if needed
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Context Savings Estimate
|
|
243
|
-
|
|
244
|
-
The hierarchical loading system reduces context consumption significantly:
|
|
245
|
-
|
|
246
|
-
### Before (Full Loading)
|
|
247
|
-
|
|
248
|
-
| Folder | Total Lines | Always Loaded |
|
|
249
|
-
|--------|-------------|---------------|
|
|
250
|
-
| rules/core/ | ~1,200 | Yes (partial) |
|
|
251
|
-
| resources/languages/ | ~800 | No |
|
|
252
|
-
| resources/patterns/ | ~2,500 | No |
|
|
253
|
-
| resources/skills/ | ~2,800 | No |
|
|
254
|
-
| resources/tools/ | ~1,400 | No |
|
|
255
|
-
| **Total** | **~8,700** | |
|
|
256
|
-
|
|
257
|
-
### After (Index + On-Demand)
|
|
258
|
-
|
|
259
|
-
| Component | Lines | When Loaded |
|
|
260
|
-
|-----------|-------|-------------|
|
|
261
|
-
| Index files (6 total) | ~600 | Per command |
|
|
262
|
-
| Average expansion | ~100-200 | Per task |
|
|
263
|
-
| **Typical session** | **~800-1,000** | |
|
|
264
|
-
|
|
265
|
-
### Estimated Savings
|
|
266
|
-
|
|
267
|
-
| Scenario | Before | After | Savings |
|
|
268
|
-
|----------|--------|-------|---------|
|
|
269
|
-
| Discovery command | ~3,500 lines | ~800 lines | ~77% |
|
|
270
|
-
| Execute plan | ~4,000 lines | ~1,000 lines | ~75% |
|
|
271
|
-
| Write tests | ~2,500 lines | ~600 lines | ~76% |
|
|
272
|
-
| **Average** | **~3,300 lines** | **~800 lines** | **~76%** |
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## System Overview
|
|
277
|
-
|
|
278
|
-
The context optimization system consists of:
|
|
279
|
-
|
|
280
|
-
### Components
|
|
281
|
-
|
|
282
|
-
| Component | Location | Purpose |
|
|
283
|
-
|-----------|----------|---------|
|
|
284
|
-
| Index Template | `resources/templates/index-template.md` | Template for creating new indexes |
|
|
285
|
-
| Core Index | `resources/core/_index.md` | Core rules reference codes |
|
|
286
|
-
| Languages Index | `resources/languages/_index.md` | Language patterns reference codes |
|
|
287
|
-
| Patterns Index | `resources/patterns/_index.md` | Pattern files reference codes |
|
|
288
|
-
| Skills Index | `resources/skills/_index.md` | Skill files reference codes |
|
|
289
|
-
| Tools Index | `resources/tools/_index.md` | Tool files reference codes |
|
|
290
|
-
| Expansion Tool | `resources/tools/reference-expansion-tool.md` | This documentation |
|
|
291
|
-
|
|
292
|
-
### Workflow Summary
|
|
293
|
-
|
|
294
|
-
```
|
|
295
|
-
Command Invoked
|
|
296
|
-
|
|
|
297
|
-
v
|
|
298
|
-
Load Command File
|
|
299
|
-
|
|
|
300
|
-
v
|
|
301
|
-
Load Relevant Indexes (_index.md)
|
|
302
|
-
|
|
|
303
|
-
v
|
|
304
|
-
Identify Needed Reference Codes
|
|
305
|
-
|
|
|
306
|
-
v
|
|
307
|
-
Expand Specific Sections (Read tool)
|
|
308
|
-
|
|
|
309
|
-
v
|
|
310
|
-
Execute Task with Loaded Context
|
|
311
|
-
|
|
|
312
|
-
v
|
|
313
|
-
(Optional) Update Indexes if Files Changed
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
---
|
|
317
|
-
|
|
318
|
-
## Summary
|
|
319
|
-
|
|
320
|
-
| Step | Action |
|
|
321
|
-
|------|--------|
|
|
322
|
-
| 1 | Load `_index.md` for relevant folder |
|
|
323
|
-
| 2 | Identify reference codes needed for task |
|
|
324
|
-
| 3 | Use Read tool with specific line ranges |
|
|
325
|
-
| 4 | Use content for current task |
|
|
326
|
-
| 5 | Update index if source files change |
|