aiwcli 0.12.2 → 0.12.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 (46) hide show
  1. package/dist/templates/_shared/.claude/commands/handoff-resume.md +8 -60
  2. package/dist/templates/_shared/.claude/commands/handoff.md +6 -226
  3. package/dist/templates/_shared/.codex/workflows/handoff.md +1 -1
  4. package/dist/templates/_shared/.windsurf/workflows/handoff.md +1 -1
  5. package/dist/templates/_shared/handoff-system/CLAUDE.md +421 -0
  6. package/dist/templates/_shared/{lib-ts/handoff → handoff-system/lib}/document-generator.ts +10 -11
  7. package/dist/templates/_shared/{lib-ts/handoff → handoff-system/lib}/handoff-reader.ts +5 -6
  8. package/dist/templates/_shared/{scripts → handoff-system/scripts}/resume_handoff.ts +19 -16
  9. package/dist/templates/_shared/{scripts → handoff-system/scripts}/save_handoff.ts +153 -43
  10. package/dist/templates/_shared/handoff-system/workflows/handoff-resume.md +66 -0
  11. package/dist/templates/_shared/{workflows → handoff-system/workflows}/handoff.md +31 -9
  12. package/dist/templates/_shared/hooks-ts/session_end.ts +66 -48
  13. package/dist/templates/_shared/hooks-ts/session_start.ts +62 -47
  14. package/dist/templates/_shared/lib-ts/base/inference.ts +73 -24
  15. package/dist/templates/_shared/lib-ts/base/state-io.ts +88 -11
  16. package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +56 -0
  17. package/dist/templates/_shared/lib-ts/context/context-formatter.ts +8 -2
  18. package/dist/templates/_shared/lib-ts/context/context-selector.ts +79 -70
  19. package/dist/templates/_shared/lib-ts/context/context-store.ts +90 -85
  20. package/dist/templates/_shared/lib-ts/types.ts +71 -64
  21. package/dist/templates/_shared/scripts/resolve_context.ts +14 -5
  22. package/dist/templates/cc-native/.claude/commands/cc-native/rlm/ask.md +136 -0
  23. package/dist/templates/cc-native/.claude/commands/cc-native/rlm/index.md +21 -0
  24. package/dist/templates/cc-native/.claude/commands/cc-native/rlm/overview.md +56 -0
  25. package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +4 -4
  26. package/dist/templates/cc-native/_cc-native/{plan-review.config.json → cc-native.config.json} +12 -0
  27. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +1 -1
  28. package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +3 -3
  29. package/dist/templates/cc-native/_cc-native/lib-ts/review-pipeline.ts +26 -4
  30. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/claude-agent.ts +1 -0
  31. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/orchestrator-claude-agent.ts +1 -0
  32. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/CLAUDE.md +480 -0
  33. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +287 -0
  34. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +148 -0
  35. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +54 -0
  36. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +58 -0
  37. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +208 -0
  38. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +460 -0
  39. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +446 -0
  40. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +280 -0
  41. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +274 -0
  42. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +201 -0
  43. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +278 -0
  44. package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +2 -1
  45. package/oclif.manifest.json +1 -1
  46. package/package.json +1 -1
@@ -1,64 +1,12 @@
1
- # Resume Handoff
2
-
3
- Restore session context from a handoff document programmatically, then create actionable ISC tasks so work continues without re-discovering what was already learned.
4
-
5
- ## Arguments
6
-
7
- - `$ARGUMENTS` - Optional path to a handoff folder or index.md. If omitted, auto-discovers the most recent handoff from the active context.
8
-
9
- ## Instructions
10
-
11
- ### Step 1: Gather Context via Script
12
-
13
- Run the resume script to collect and format all handoff sections:
14
-
15
- **If `$ARGUMENTS` is provided:**
16
- ```bash
17
- bun .aiwcli/_shared/scripts/resume_handoff.ts "$ARGUMENTS"
18
- ```
19
-
20
- **If `$ARGUMENTS` is empty:**
21
- The script auto-discovers the active context ID programmatically — no manual lookup needed:
22
- ```bash
23
- bun .aiwcli/_shared/scripts/resume_handoff.ts
24
- ```
25
-
26
- Present the script's output to the conversation. The output is already structured in priority order (dead ends first, then pending items, decisions, git delta, completed work, context notes).
1
+ ---
2
+ name: handoff-resume
3
+ description: Resume handoff
4
+ ---
27
5
 
28
- If the script exits with an error, show the error message and stop.
29
-
30
- ### Step 2: Create ISC Tasks
31
-
32
- Convert each actionable item from the script output into a task via `TaskCreate`:
33
- - Each pending issue from the **Pending Items** section
34
- - Each remaining plan item from the **Plan — Remaining Items** section
35
-
36
- Each task follows ISC format — ~8 words, states a desired end-state (not an action), and is binary testable in 2 seconds.
37
-
38
- **Example:**
39
-
40
- | Source | ISC Task |
41
- |--------|----------|
42
- | Pending: "Fix race condition in SessionStore" | "SessionStore handles concurrent access without race conditions" |
43
- | Plan remaining: "Add retry logic to API client" | "API client retries failed requests with exponential backoff" |
44
- | Next step: "Write tests for auth flow" | "Auth flow has passing integration test coverage" |
45
-
46
- ### Step 3: Confirm Ready
47
-
48
- After creating tasks, run `TaskList` and confirm ready to continue.
49
-
50
- ## Constraints
6
+ # Resume Handoff
51
7
 
52
- - Dead ends are presented verbatim from the script output never summarize or omit entries
53
- - ISC tasks use ~8-word end-state format, not action descriptions
54
- - Skip missing files gracefully (the script handles this)
55
- - If the script warns about staleness (>7 days), surface the warning prominently
8
+ Restore context from a handoff document and create ISC tasks. See `.aiwcli/_shared/handoff-system/workflows/handoff-resume.md` for complete process documentation.
56
9
 
57
- ## Success Criteria
10
+ **Quick trigger:** `/handoff-resume` or `/handoff-resume path/to/handoff`
58
11
 
59
- - [ ] Script ran successfully and output the structured briefing
60
- - [ ] Dead ends visible in conversation (not summarized)
61
- - [ ] Pending items converted to ISC tasks via TaskCreate
62
- - [ ] Plan completion percentage visible (if plan exists)
63
- - [ ] Git delta visible
64
- - [ ] Tasks confirmed via TaskList
12
+ The workflow uses the resume script to load handoff sections and convert pending items to tasks.
@@ -1,232 +1,12 @@
1
- # Handoff Workflow
2
-
3
- Generate a handoff document summarizing the current session's work, decisions, and pending items. Optionally update a plan document to track completed vs remaining tasks.
4
-
5
- ## Triggers
6
-
7
- - `/handoff` command
8
- - `/handoff path/to/PLAN.md` - with plan document integration
9
- - Phrases like "write a handoff", "create a session summary", "document what we did", "end session with notes"
10
-
11
- ## Arguments
12
-
13
- - `$ARGUMENTS` - Optional path to a plan document. If provided, the handoff will:
14
- 1. Mark completed items in the plan with `[x]`
15
- 2. Add notes about partial progress
16
- 3. Append a "Session Progress" section to the plan
17
-
18
- ## Process
19
-
20
- ### Step 1: Get Context ID
21
-
22
- Resolve the active context ID programmatically:
23
-
24
- ```bash
25
- bun .aiwcli/_shared/scripts/resolve_context.ts
26
- ```
27
-
28
- This prints the active context ID to stdout. Use its output as `{context_id}` in subsequent steps.
29
-
30
- If the script exits with an error (no active context found), inform the user and stop — handoffs require an active context.
31
-
32
- ### Step 2: Gather Information
33
-
34
- 1. Review conversation history for:
35
- - Completed tasks and implementations
36
- - Key decisions and their rationale
37
- - Failed approaches (to avoid repeating)
38
- - External context (deadlines, stakeholder requirements)
39
-
40
- 2. Check git status if available:
41
- ```bash
42
- git status --short
43
- git diff --stat
44
- ```
45
-
46
- 3. Look for TODOs/FIXMEs mentioned in session
47
-
48
- 4. **If plan document provided**: Read the plan and identify:
49
- - Tasks that are now completed
50
- - Tasks that are partially done
51
- - Tasks that were attempted but blocked
52
- - New tasks discovered during implementation
53
-
54
- ### Step 3: Generate Document
55
-
56
- Use this template. The `<!-- SECTION: name -->` markers are required for the save script to parse sections into sharded files.
57
-
58
- ```markdown
59
- ---
60
- title: Session Handoff
61
- date: {ISO timestamp}
62
- session_id: {conversation ID if available}
63
- project: {project name from package.json, Cargo.toml, or directory name}
64
- context_id: {context_id from Step 1}
65
- plan_document: {path to plan if provided, or "none"}
66
- ---
67
-
68
- # Session Handoff — {Date}
69
-
70
- <!-- SECTION: summary -->
71
- ## Summary
72
- {2-3 sentences: what's different now vs. session start}
73
-
74
- <!-- SECTION: completed -->
75
- ## Work Completed
76
- {Grouped by category if multiple areas. Specific file:function references.}
77
-
78
- <!-- SECTION: dead-ends -->
79
- ## Dead Ends — Do Not Retry
80
-
81
- These approaches were attempted and failed. Do not retry without addressing the root cause.
82
-
83
- | Approach | Why It Failed | Time Spent | Alternative |
84
- |----------|---------------|------------|-------------|
85
- | {What was attempted} | {Specific reason} | {Rough estimate} | {What to try instead} |
86
-
87
- <!-- SECTION: decisions -->
88
- ## Key Decisions
89
- {Technical choices with rationale. Format: **Decision**: Rationale. Trade-off: X.}
90
-
91
- <!-- SECTION: pending -->
92
- ## Pending Issues
93
- - [ ] {Issue} — {severity: HIGH/MED/LOW} {optional workaround note}
94
-
95
- <!-- SECTION: next-steps -->
96
- ## Next Steps
97
- 1. {Actionable item with file:line reference if applicable}
98
-
99
- <!-- SECTION: files -->
100
- ## Files Modified
101
- {Significant changes only. Skip formatting-only edits.}
102
-
103
- <!-- SECTION: context -->
104
- ## Context for Future Sessions
105
- {Non-obvious context: env quirks, stakeholder requirements}
106
-
107
- ```
108
-
109
- ### Step 4: Update Plan Document (if provided)
110
-
111
- If a plan document path was provided in `$ARGUMENTS`:
112
-
113
- 1. **Read the plan document**
114
- 2. **Identify completed items**:
115
- - Find checkboxes `- [ ]` that match completed work
116
- - Change them to `- [x]`
117
- 3. **Add progress notes** to items that are partially complete:
118
- - Append `(partial: {brief status})` to the line
119
- 4. **Append Session Progress section** at the bottom:
120
-
121
- ```markdown
122
-
123
1
  ---
124
-
125
- ## Session Progress Log
126
-
127
- ### {Date} — Session {session_id or timestamp}
128
-
129
- **Completed this session:**
130
- - [x] {Task from plan that was completed}
131
- - [x] {Another completed task}
132
-
133
- **Partially completed:**
134
- - {Task} — {current state, what remains}
135
-
136
- **Blocked/Deferred:**
137
- - {Task} — {reason, what's needed}
138
-
139
- **New items discovered:**
140
- - [ ] {New task not in original plan}
141
- - [ ] {Another new task}
142
-
2
+ name: handoff
3
+ description: Create handoff document
143
4
  ---
144
- ```
145
-
146
- 5. **If no plan document was provided**:
147
- - Skip plan creation - the handoff document serves as the session record
148
5
 
149
- ### Step 5: Save and Update Status
150
-
151
- Instead of writing the file directly, pipe your handoff content to the save script:
152
-
153
- ```bash
154
- bun .aiwcli/_shared/scripts/save_handoff.ts "{context_id}" <<'EOF'
155
- {Your complete handoff markdown content from Step 3}
156
- EOF
157
- ```
158
-
159
- This script:
160
- 1. Creates a folder at `_output/contexts/{context_id}/handoffs/{YYYY-MM-DD-HHMM}/`
161
- 2. Parses sections and writes sharded files (index.md, completed-work.md, dead-ends.md, etc.)
162
- 3. Copies the current plan (if any) to plan.md
163
- 4. Sets `handoff_path` to the index.md path and `handoff_consumed = false` in state.json
164
- 5. Mode stays `active` — staging happens later via session_end hook
165
-
166
- When the session ends, `session_end.ts` stages `active → has_handoff` (if handoff_path
167
- exists and handoff_consumed is false). On next `/clear`, `session_start.ts` picks up the
168
- `has_handoff` state, binds the new session, transitions to `active`, and injects the
169
- handoff content via `formatHandoffContinuation()`.
170
-
171
- ## Dead Ends Section Guidelines
172
-
173
- This section is critical for preventing context rot across sessions. Be specific:
174
-
175
- **Bad (too vague):**
176
- > - Tried using library X, didn't work
177
-
178
- **Good (actionable):**
179
- > ### Fixing the race condition in SessionStore
180
- > | Approach Tried | Why It Failed |
181
- > |----------------|---------------|
182
- > | `async-mutex` package | Deadlock when nested calls to `getSession()` |
183
- > | Redis WATCH/MULTI | Our Redis 6.x cluster doesn't support WATCH in cluster mode |
184
- > | In-memory lock Map | Works single-node but breaks in horizontal scaling |
185
- >
186
- > **What to try instead**: Upgrade to Redis 7.x which supports WATCH in cluster mode, or use Redlock algorithm
187
-
188
- **Capture these dead ends:**
189
- - Packages/libraries that had incompatibilities
190
- - Approaches that caused new bugs or regressions
191
- - Solutions that worked locally but failed in CI/staging/prod
192
- - Configurations that conflicted with existing setup
193
- - Rabbit holes that consumed significant time without progress
194
-
195
- ## Post-Generation Output
196
-
197
- After creating file, output:
198
-
199
- ```
200
- ✓ Created handoff folder: _output/contexts/{context_id}/handoffs/{YYYY-MM-DD-HHMM}/
201
- - index.md (entry point with navigation)
202
- - completed-work.md, dead-ends.md, decisions.md, pending.md, context.md
203
- - plan.md (copy of current plan, if any)
204
-
205
- To continue next session:
206
- Automatic: Handoff restored on next /clear via session_start hook.
207
- Manual: Use /handoff-resume to explicitly load handoff context at any time.
208
- Read dead-ends.md first to avoid repeating failed approaches.
209
-
210
- ⚠️ {N} dead ends documented — avoid re-attempting these approaches
211
- ```
6
+ # Handoff Workflow
212
7
 
213
- If plan was updated:
214
- ```
215
- ✓ Updated plan document: {path}
216
- - {N} items marked complete
217
- - {N} items partially complete
218
- - {N} new items added
219
- ```
8
+ Generate a comprehensive handoff document for the next session. See `.aiwcli/_shared/handoff-system/workflows/handoff.md` for complete process documentation.
220
9
 
221
- ## Success Criteria
10
+ **Quick trigger:** `/handoff` or `/handoff path/to/PLAN.md`
222
11
 
223
- - [ ] Handoff folder created at `handoffs/{YYYY-MM-DD-HHMM}/`
224
- - [ ] index.md contains summary and navigation table
225
- - [ ] All section files created (completed-work.md, dead-ends.md, etc.)
226
- - [ ] Dead ends use structured table format for quick scanning
227
- - [ ] plan.md copied from context if plan exists
228
- - [ ] Next steps are actionable with file references
229
- - [ ] Git status included in index.md
230
- - [ ] If plan provided: checkboxes updated to reflect completion status
231
- - [ ] If plan provided: Session Progress Log appended
232
- - [ ] State has handoff_path set and handoff_consumed = false
12
+ The workflow guides you through gathering session context, generating structured sections, and saving via the handoff system.
@@ -150,7 +150,7 @@ If a plan document path was provided in `$ARGUMENTS`:
150
150
  Instead of writing the file directly, pipe your handoff content to the save script:
151
151
 
152
152
  ```bash
153
- bun .aiwcli/_shared/scripts/save_handoff.ts "{context_id}" <<'EOF'
153
+ bun .aiwcli/_shared/handoff-system/scripts/save_handoff.ts "{context_id}" <<'EOF'
154
154
  {Your complete handoff markdown content from Step 3}
155
155
  EOF
156
156
  ```
@@ -150,7 +150,7 @@ If a plan document path was provided in `$ARGUMENTS`:
150
150
  Instead of writing the file directly, pipe your handoff content to the save script:
151
151
 
152
152
  ```bash
153
- bun .aiwcli/_shared/scripts/save_handoff.ts "{context_id}" <<'EOF'
153
+ bun .aiwcli/_shared/handoff-system/scripts/save_handoff.ts "{context_id}" <<'EOF'
154
154
  {Your complete handoff markdown content from Step 3}
155
155
  EOF
156
156
  ```