ostacky 0.7.2 → 0.7.4

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.
@@ -1,239 +1,251 @@
1
- ---
2
- name: graceful-degradation
3
- description: "Handle situations where multiple tools (CodeGraph, Engram MCP, Controller) are unavailable. Provides a systematic approach to continue working with reduced capabilities."
4
- ---
5
-
6
- # Graceful Degradation
7
-
8
- When critical tools are unavailable, this skill provides a systematic approach to continue working with reduced capabilities instead of failing completely.
9
-
10
- **Follow Core Instructions** — `ostacky.md` Core Instructions section for CodeGraph and Engram usage patterns.
11
-
12
- **IMPORTANT:** Engram is an **MCP server**, not a skill. Tools `engram_mem_save`, `engram_mem_search`, `engram_mem_context` are MCP tools. Do NOT use `skill("engram")` — it doesn't exist.
13
-
14
- ---
15
-
16
- ## Tool Availability Matrix
17
-
18
- | Tool | Type | Fallback Chain | Impact |
19
- |------|------|----------------|--------|
20
- | CodeGraph | MCP server | Engram → Read + Glob | No structural analysis, manual exploration |
21
- | Engram | MCP server | Continue without memory | No persistence across sessions |
22
- | Controller | MCP server | Inline validation + manual state | No state machine, no edit validation |
23
- | Context7 | MCP server (remote) | Skip documentation | No external API docs |
24
-
25
- ## Detection
26
-
27
- After health check pre-vuelo, classify the situation:
28
-
29
- ### All Tools Available
30
- Normal operation. No degradation needed.
31
-
32
- ### Partial Degradation (1-2 tools down)
33
- Continue with available tools. Report to user.
34
-
35
- ### Complete Degradation (All tools down)
36
- Switch to basic mode with manual workflows.
37
-
38
- ## Degraded Workflows
39
-
40
- ### Without CodeGraph
41
-
42
- **Available alternatives:**
43
- 1. **Engram** — Check if previous analysis exists for the area
44
- 2. **Read + Glob** — Manual file exploration
45
-
46
- **Workflow:**
47
- ```
48
- 1. engram_mem_search for related analysis (if Engram available)
49
- 2. Use Glob to find relevant files: **/*.ts, src/**/*.ts
50
- 3. Read files manually to understand structure
51
- 4. Proceed with caution — no blast radius analysis
52
- ```
53
-
54
- **Limitations:**
55
- - No call path analysis
56
- - No blast radius calculation
57
- - No symbol search
58
- - Higher risk of missing dependencies
59
-
60
- ### Without Engram
61
-
62
- **Available alternatives:**
63
- 1. **OpenSpec** — Check for active changes with proposals/designs
64
- 2. **Filesystem** — Check for previous analysis docs
65
-
66
- **Workflow:**
67
- ```
68
- 1. Check openspec/changes/ for active change artifacts
69
- 2. Check docs/superpowers/specs/ for design documents
70
- 3. Proceed without session memory
71
- 4. At session end, document key decisions in a summary
72
- ```
73
-
74
- **Limitations:**
75
- - No cross-session memory
76
- - No decision history
77
- - Risk of repeating previous mistakes
78
-
79
- ### Without Controller
80
-
81
- **Available alternatives:**
82
- 1. **Inline validation** — Manual edit validation
83
- 2. **Manual state tracking** — Track progress in conversation
84
-
85
- **Workflow:**
86
- ```
87
- 1. For each edit:
88
- - Read file fresh
89
- - Verify oldString ≠ newString
90
- - Verify oldString appears exactly once
91
- - Execute edit
92
- 2. Track completed tasks mentally or in conversation
93
- 3. No automatic state persistence
94
- ```
95
-
96
- **IMPORTANT — No check_pending_state:**
97
- When controller is unavailable, `check_pending_state` does NOT exist.
98
- - Do NOT try to call it — it will fail
99
- - The enforcement rule in Core Instructions applies ONLY when controller is available
100
- - In degraded mode, rely on the "Una pregunta por turno" rule directly
101
-
102
- **Limitations:**
103
- - No automatic edit validation
104
- - No task completion tracking
105
- - No state persistence across crashes
106
- - No pending state enforcement (check_pending_state unavailable)
107
-
108
- ### Without Context7
109
-
110
- **Impact:** Minimal — only affects external API documentation lookups.
111
-
112
- **Workflow:** Proceed normally. Use existing knowledge.
113
-
114
- ## Communication Protocol
115
-
116
- ### Status Report Format
117
-
118
- When degradation is detected, report to user:
119
-
120
- ```
121
- ⚠️ [Tool] no disponible usando fallback: [fallback]
122
-
123
- Herramientas disponibles:
124
- [Tool1] — [status]
125
- ❌ [Tool2] — [fallback being used]
126
- ⚠️ [Tool3] — [degraded mode]
127
-
128
- ¿Continuar con funcionalidad reducida?
129
- ```
130
-
131
- ### Example Reports
132
-
133
- **CodeGraph down:**
134
- ```
135
- ⚠️ CodeGraph no disponible — usando fallback: Engram → Read
136
-
137
- Herramientas disponibles:
138
- Controllerping OK
139
- ❌ CodeGraph — timeout 10s
140
- Engram — disponible
141
- Context7disponible
142
-
143
- ¿Continuar con lectura manual de archivos?
144
- ```
145
-
146
- **All tools down:**
147
- ```
148
- 🔴 Stack de herramientas no disponible — modo básico activado
149
-
150
- Herramientas disponibles:
151
- Controller no responde
152
- ❌ CodeGraph — no instalado
153
- Engram — timeout 5s
154
- Context7disponible (pero sin docs relevantes)
155
-
156
- Modo básico: sin validación de edits, sin memoria persistente, sin análisis estructural.
157
- ¿Continuar o cancelar?
158
- ```
159
-
160
- ## Handoff Fallback (compaction)
161
-
162
- Si el controller hizo `set_handoff` o el plugin escribió el fallback `dirname(OSTACKY_STATE_PATH)/.ostacky-handoff-compaction.json` antes de compaction, el próximo agente **debe** llamar `get_handoff` al inicio. `get_handoff` primero chequea `lastHandoff` en memoria y si es `null` lee el archivo fallback (mismo ancla que el writer). `clear_handoff` borra ambos. `cleanupTmpFiles` solo borra ese archivo si `ts >24h`. Ver `assets/plugins/engram.ts:experimental.session.compacting` y `assets/mcp/ostacky-controller/index.js:get_handoff`.
163
-
164
- ## Recovery After Degradation
165
-
166
- When a tool becomes available again during the session:
167
-
168
- 1. **Detect:** Health check succeeds on next call
169
- 2. **Report:** "✅ [Tool] disponible nuevamente"
170
- 3. **Resume:** Switch back to normal workflow
171
- 4. **Catch up:** Use the tool to verify recent work
172
-
173
- ## Guardrails
174
-
175
- ### During Degradation
176
-
177
- - **Never skip validation** — Use inline validation when controller is down
178
- - **Never assume structure**Read files even if you think you know them
179
- - **Document decisions** Write down key choices since Engram may be down
180
- - **Report limitations** User must know what's working and what's not
181
-
182
- ### When Choosing to Continue
183
-
184
- Ask yourself:
185
- 1. Can I safely complete this task without the missing tool?
186
- 2. What's the worst case if I proceed without it?
187
- 3. Is the user aware of the limitations?
188
-
189
- If unsure ask the user.
190
-
191
- ### When to Stop
192
-
193
- - All critical tools are down AND the task requires them
194
- - The task is high-risk without structural analysis (CodeGraph)
195
- - The user requests to stop
196
-
197
- ## Integration
198
-
199
- This skill is loaded automatically when the agent detects tool failures during the health check pre-vuelo.
200
-
201
- It does NOT replace other skills — it provides degraded workflows for them.
202
-
203
- ## Examples
204
-
205
- ### Example 1: CodeGraph fails, others work
206
-
207
- ```
208
- Agent: ⚠️ CodeGraph no disponible (timeout 10s).
209
-
210
- Voy a usar Engram para buscar análisis previos y luego leer archivos manualmente.
211
-
212
- ¿Continuar con esta aproximación?
213
-
214
- User: Sí
215
-
216
- Agent: [Uses engram_mem_search to find related analysis]
217
- [Uses Glob to find relevant files]
218
- [Reads files manually]
219
- [Proceeds with task]
220
- ```
221
-
222
- ### Example 2: Controller fails
223
-
224
- ```
225
- Agent: ⚠️ Controller no disponible — operando con validación inline.
226
-
227
- Cada edit será validado manualmente:
228
- - oldString newString
229
- - oldString aparece exactamente una vez
230
-
231
- ¿Continuar?
232
-
233
- User: Sí
234
-
235
- Agent: [Reads file fresh]
236
- [Validates oldString manually]
237
- [Executes edit]
238
- [Reports completion]
239
- ```
1
+ ---
2
+ name: graceful-degradation
3
+ description: "Handle situations where multiple tools (CodeGraph, Engram MCP, Controller) are unavailable. Provides a systematic approach to continue working with reduced capabilities."
4
+ ---
5
+
6
+ # Graceful Degradation
7
+
8
+ When critical tools are unavailable, this skill provides a systematic approach to continue working with reduced capabilities instead of failing completely.
9
+
10
+ **Follow Core Instructions** — `ostacky.md` Core Instructions section for CodeGraph and Engram usage patterns.
11
+
12
+ **IMPORTANT:** Engram is an **MCP server**, not a skill. Tools `engram_mem_save`, `engram_mem_search`, `engram_mem_context` are MCP tools. Do NOT use `skill("engram")` — it doesn't exist.
13
+
14
+ ---
15
+
16
+ ## Tool Availability Matrix
17
+
18
+ | Tool | Type | Fallback Chain | Impact |
19
+ |------|------|----------------|--------|
20
+ | CodeGraph | MCP server | Engram → Read + Glob | No structural analysis, manual exploration |
21
+ | Engram | MCP server | Continue without memory | No persistence across sessions |
22
+ | Controller | MCP server | Inline validation + manual state | No state machine, no edit validation |
23
+ | Context7 | MCP server (remote) | Skip documentation | No external API docs |
24
+
25
+ ## Detection
26
+
27
+ After health check pre-vuelo, classify the situation:
28
+
29
+ ### All Tools Available
30
+ Normal operation. No degradation needed.
31
+
32
+ ### Partial Degradation (1-2 tools down)
33
+ Continue with available tools. Report to user.
34
+
35
+ ### Complete Degradation (All tools down)
36
+ Switch to basic mode with manual workflows.
37
+
38
+ ## Degraded Workflows
39
+
40
+ ### Without CodeGraph
41
+
42
+ **Available alternatives:**
43
+ 1. **Engram** — Check if previous analysis exists for the area
44
+ 2. **Read + Glob** — Manual file exploration
45
+
46
+ **Workflow:**
47
+ ```
48
+ 1. engram_mem_search for related analysis (if Engram available)
49
+ 2. Use Glob to find relevant files: **/*.ts, src/**/*.ts
50
+ 3. Read files manually to understand structure
51
+ 4. Proceed with caution — no blast radius analysis
52
+ ```
53
+
54
+ **Limitations:**
55
+ - No call path analysis
56
+ - No blast radius calculation
57
+ - No symbol search
58
+ - Higher risk of missing dependencies
59
+
60
+ ### Without Engram
61
+
62
+ **Available alternatives:**
63
+ 1. **OpenSpec** — Check for active changes with proposals/designs
64
+ 2. **Filesystem** — Check for previous analysis docs
65
+
66
+ **Workflow:**
67
+ ```
68
+ 1. Check openspec/changes/ for active change artifacts
69
+ 2. Check docs/superpowers/specs/ for design documents
70
+ 3. Proceed without session memory
71
+ 4. At session end, document key decisions in a summary
72
+ ```
73
+
74
+ **Limitations:**
75
+ - No cross-session memory
76
+ - No decision history
77
+ - Risk of repeating previous mistakes
78
+
79
+ ### Without Controller
80
+
81
+ **Available alternatives:**
82
+ 1. **Inline validation** — Manual edit validation
83
+ 2. **Manual state tracking** — Track progress in conversation
84
+
85
+ **Workflow:**
86
+ ```
87
+ 1. For each edit:
88
+ - Read file fresh
89
+ - Verify oldString ≠ newString
90
+ - Verify oldString appears exactly once
91
+ - Execute edit
92
+ 2. Track completed tasks mentally or in conversation
93
+ 3. No automatic state persistence
94
+ ```
95
+
96
+ **IMPORTANT — No check_pending_state:**
97
+ When controller is unavailable, `check_pending_state` does NOT exist.
98
+ - Do NOT try to call it — it will fail
99
+ - The enforcement rule in Core Instructions applies ONLY when controller is available
100
+ - In degraded mode, rely on the "Una pregunta por turno" rule directly
101
+
102
+ **Hard gate de credenciales (hardening-v2 P0):**
103
+ Incluso en degraded, el guard de credenciales sigue activo (hard gate incluso en degraded). `bash`/`read`/`write`/`edit` sobre `.env`, `.secrets`, `*.pem`, `*.key`, `.aws`, `.ssh`, `credentials.json`, `.npmrc` sin `allowedFiles` sigue lanzando `BLOCKED` — nunca uses `bash cat .env` sin `check_file_access → consume ALLOW` auditado (ver `assets/agents/ostacky.md` §Credential Guard).
104
+
105
+ **Limitations:**
106
+ - No automatic edit validation
107
+ - No task completion tracking
108
+ - No state persistence across crashes
109
+ - No pending state enforcement (check_pending_state unavailable)
110
+
111
+ ### Without Context7
112
+
113
+ **Impact:** Minimal — only affects external API documentation lookups.
114
+
115
+ **Workflow:** Proceed normally. Use existing knowledge.
116
+
117
+ ## Communication Protocol
118
+
119
+ ### Status Report Format
120
+
121
+ When degradation is detected, report to user:
122
+
123
+ ```
124
+ ⚠️ [Tool] no disponible usando fallback: [fallback]
125
+
126
+ Herramientas disponibles:
127
+ ✅ [Tool1] — [status]
128
+ [Tool2] [fallback being used]
129
+ ⚠️ [Tool3] — [degraded mode]
130
+
131
+ ¿Continuar con funcionalidad reducida?
132
+ ```
133
+
134
+ ### Example Reports
135
+
136
+ **CodeGraph down:**
137
+ ```
138
+ ⚠️ CodeGraph no disponible usando fallback: Engram → Read
139
+
140
+ Herramientas disponibles:
141
+ Controllerping OK
142
+ ❌ CodeGraph — timeout 10s
143
+ Engram disponible
144
+ ✅ Context7 — disponible
145
+
146
+ ¿Continuar con lectura manual de archivos?
147
+ ```
148
+
149
+ **All tools down:**
150
+ ```
151
+ 🔴 Stack de herramientas no disponible — modo básico activado
152
+
153
+ Herramientas disponibles:
154
+ Controllerno responde
155
+ ❌ CodeGraph — no instalado
156
+ Engram timeout 5s
157
+ Context7 — disponible (pero sin docs relevantes)
158
+
159
+ Modo básico: sin validación de edits, sin memoria persistente, sin análisis estructural.
160
+ ¿Continuar o cancelar?
161
+ ```
162
+
163
+ ## Handoff Fallback (compaction)
164
+
165
+ Si el controller hizo `set_handoff` o el plugin escribió el fallback `dirname(OSTACKY_STATE_PATH)/.ostacky-handoff-compaction.json` antes de compaction, el próximo agente **debe** llamar `get_handoff` al inicio. `get_handoff` primero chequea `lastHandoff` en memoria y si es `null` lee el archivo fallback (mismo ancla que el writer). `clear_handoff` borra ambos. `cleanupTmpFiles` solo borra ese archivo si `ts >24h`. Ver `assets/plugins/engram.ts:experimental.session.compacting` y `assets/mcp/ostacky-controller/index.js:get_handoff`.
166
+
167
+ ## Recovery After Degradation
168
+
169
+ When a tool becomes available again during the session:
170
+
171
+ 1. **Detect:** Health check succeeds on next call
172
+ 2. **Report:** "✅ [Tool] disponible nuevamente"
173
+ 3. **Resume:** Switch back to normal workflow
174
+ 4. **Catch up:** Use the tool to verify recent work
175
+
176
+ ## Health via get_metrics y doctor (6.2)
177
+
178
+ - **Con Controller:** usar `get_metrics` como health expone `degraded`, `diskFreeMB`, `auditSize`, `stateFileSize`, `codegraphBypassCount`, `stateOversizedCount`, `degradedEditsCount`, `sensitiveAccess`. Si `diskFreeMB<100` → ⚠️ Disco casi lleno; si `stateOversizedCount>0` → snapshots perdidos.
179
+ - **Sin Controller:** fallback a `ostacky doctor` (lee `.opencode/ostacky-state.json` sin MCP, verifica locks, tamaños, audit, binarios y `manifest.json` hashes). `doctor` es el fallback a `check:skills` cuando MCP caído.
180
+ - **Sin CodeGraph:** `get_metrics.codegraphBypassCount` incrementa cuando `record_discovery` sin `symbols` y no degraded; `get_audit` marca `inefficient: codegraph bypass` para review.
181
+ - **Sin Engram:** continuar sin memoria; `doctor` no requiere Engram.
182
+
183
+ No usar `skill("engram")` — Engram es MCP server, no skill. Usar `engram_mem_*` tools.
184
+
185
+ ## Guardrails
186
+
187
+ ### During Degradation
188
+
189
+ - **Never skip validation** Use inline validation when controller is down
190
+ - **Never assume structure** — Read files even if you think you know them
191
+ - **Document decisions** — Write down key choices since Engram may be down
192
+ - **Report limitations** — User must know what's working and what's not
193
+
194
+ ### When Choosing to Continue
195
+
196
+ Ask yourself:
197
+ 1. Can I safely complete this task without the missing tool?
198
+ 2. What's the worst case if I proceed without it?
199
+ 3. Is the user aware of the limitations?
200
+
201
+ If unsure ask the user.
202
+
203
+ ### When to Stop
204
+
205
+ - All critical tools are down AND the task requires them
206
+ - The task is high-risk without structural analysis (CodeGraph)
207
+ - The user requests to stop
208
+
209
+ ## Integration
210
+
211
+ This skill is loaded automatically when the agent detects tool failures during the health check pre-vuelo.
212
+
213
+ It does NOT replace other skills — it provides degraded workflows for them.
214
+
215
+ ## Examples
216
+
217
+ ### Example 1: CodeGraph fails, others work
218
+
219
+ ```
220
+ Agent: ⚠️ CodeGraph no disponible (timeout 10s).
221
+
222
+ Voy a usar Engram para buscar análisis previos y luego leer archivos manualmente.
223
+
224
+ ¿Continuar con esta aproximación?
225
+
226
+ User: Sí
227
+
228
+ Agent: [Uses engram_mem_search to find related analysis]
229
+ [Uses Glob to find relevant files]
230
+ [Reads files manually]
231
+ [Proceeds with task]
232
+ ```
233
+
234
+ ### Example 2: Controller fails
235
+
236
+ ```
237
+ Agent: ⚠️ Controller no disponible — operando con validación inline.
238
+
239
+ Cada edit será validado manualmente:
240
+ - oldString ≠ newString
241
+ - oldString aparece exactamente una vez
242
+
243
+ ¿Continuar?
244
+
245
+ User: Sí
246
+
247
+ Agent: [Reads file fresh]
248
+ [Validates oldString manually]
249
+ [Executes edit]
250
+ [Reports completion]
251
+ ```
@@ -201,6 +201,14 @@ Ready to implement auth feature
201
201
  - Auto-detect and run project setup
202
202
  - Verify clean test baseline
203
203
 
204
+ ## Ostacky Worktree Isolation
205
+
206
+ Cada worktree de git es **aislado** para Ostacky:
207
+
208
+ - **State file independiente:** `findProjectRoot()` resuelve el root del worktree vía `git rev-parse --show-toplevel` (cada worktree tiene su propio `.opencode/ostacky-state.json`). Dos worktrees no comparten `statePath`, por lo que `ostacky-controller` no pisa estados entre worktrees.
209
+ - **Lock independiente:** cada worktree tiene su propio `.lock` y `.backup` rotativo, por lo que 3 agentes en 3 worktrees no corrompen el lock del otro.
210
+ - **Verificación:** `tests` con dos tmp dirs simulando worktrees verifican que no comparten `statePath` y que `doctor` reporta OK en cada uno.
211
+
204
212
  ## Integration
205
213
 
206
214
  **Called by:**