decapod 0.47.21

Decapod is the daemonless, local-first control plane that agents call on demand to align intent, enforce boundaries, and produce proof-backed completion across concurrent multi-agent work. πŸ¦€
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# GAPS.md - Gap Analysis & Systemic Improvement Methodology

**Authority:** guidance (systematic gap identification and routing methodology)
**Layer:** Guides
**Binding:** No
**Scope:** how to identify, categorize, and route gaps in Decapod-managed systems
**Non-goals:** replacing TODO system, substituting for proof, or defining authoritative requirements

⚠️ **CRITICAL: Gap analysis is continuous intelligence work, not one-time audits.** ⚠️

This document defines the practice of systemic gap identification: finding what's missing, misaligned, or underdeveloped in the system, and routing those findings to the appropriate subsystems for resolution.

---

## 1. What Is a Gap

A **gap** is any delta between:
- **Current state** (what exists)
- **Required state** (what must exist)
- **Desired state** (what should exist for optimal performance)

Gaps are not bugs. Bugs are deviations from spec. Gaps are *missing or incomplete specifications, implementations, or capabilities*.

---

## 2. Gap Categories

### 2.1 Interface Gaps (`interfaces/`)
**Definition:** Missing or incomplete binding contracts, schemas, or invariants.

**Examples:**
- CLI surface without corresponding schema documentation
- Store semantics that allow contamination
- Proof surface that doesn't actually validate what it claims
- Undefined behavior at subsystem boundaries
- Schema drift (doc says X, code does Y)

**Detection:**
- Run `decapod validate` and analyze warnings
- Compare subsystem registry (PLUGINS.md) to actual CLI help output
- Check for `STUB` or `SPEC` items without graduation path
- Review error messages for undocumented edge cases

**Routing:**
- Interface contract issues β†’ `interfaces/INTERFACES.md`
- Store model violations β†’ `interfaces/STORE_MODEL.md`
- Doc compilation errors β†’ `interfaces/DOC_RULES.md`
- Claims without proof β†’ `interfaces/CLAIMS.md`
- Undefined terms β†’ `interfaces/GLOSSARY.md`

**See:** `interfaces/INTERFACES.md` for interface contract registry

---

### 2.2 Methodology Gaps (`methodology/`)
**Definition:** Missing guidance, unclear practices, or incomplete cognitive frameworks.

**Examples:**
- Agent doesn't know how to handle a specific scenario
- Architecture practice lacks decision criteria
- Knowledge management has no staleness policy
- Memory system lacks retrieval validation
- Unclear when to use which subsystem
- UI components lack architectural patterns
- Frontend/backend integration undefined

**Detection:**
- Agents asking repetitive clarifying questions
- Inconsistent approaches to similar problems
- Documentation exists but isn't actionable
- Process gaps in multi-agent coordination
- Missing "how to" guidance for common tasks
- UI implementations diverge without pattern

**Routing:**
- Intent-driven workflow gaps β†’ `specs/INTENT.md` (binding methodology)
- Architecture practice gaps β†’ `methodology/ARCHITECTURE.md`
- Agent behavior gaps β†’ `methodology/SOUL.md`
- Knowledge management gaps β†’ `methodology/KNOWLEDGE.md`
- Learning/memory gaps β†’ `methodology/MEMORY.md`
- UI architecture gaps β†’ `architecture/UI.md`
- Frontend architecture gaps β†’ `architecture/FRONTEND.md`

**See:** `core/METHODOLOGY.md` for methodology registry

---

### 2.3 Plugin/Subsystem Gaps (`plugins/`)
**Definition:** Missing functionality, incomplete implementations, or subsystem boundary issues.

**Examples:**
- TODO system lacks classification features
- Health system doesn't track subsystem X
- Missing cron job scheduling granularity
- No knowledge→TODO linking mechanism
- Gap between planned (SPEC) and implemented (REAL)

**Detection:**
- Compare PLUGINS.md registry to actual capabilities
- User requests for missing features
- Workarounds agents invent for missing functionality
- Cross-subsystem coordination failures
- Performance bottlenecks at subsystem boundaries

**Routing:**
- Subsystem status issues β†’ `core/PLUGINS.md`
- Plugin-specific gaps β†’ respective `plugins/<NAME>.md`
- Integration gaps β†’ relevant subsystem docs + PLUGINS.md

**See:** `core/PLUGINS.md` Β§3.5 for subsystem registry and truth labels

---

### 2.4 Core/Coordination Gaps (`core/`)
**Definition:** Issues in routing, navigation, or system-wide coordination.

**Examples:**
- DECAPOD.md doesn't route to a documented subsystem
- Cross-category references are broken
- OVERRIDE.md isn't being respected
- Gap between demands and enforcement
- Missing emergency protocols

**Detection:**
- `decapod validate` failures in doc graph
- Broken links in constitution
- Navigation failures (can't find docs)
- Override system not functioning
- Contradictions between core files

**Routing:**
- Router/navigation gaps β†’ `core/DECAPOD.md`
- Interface index gaps β†’ `core/INTERFACES.md`
- Methodology index gaps β†’ `core/METHODOLOGY.md`
- Subsystem registry gaps β†’ `core/PLUGINS.md`
- User demand gaps β†’ `core/DEMANDS.md`
- Deprecation gaps β†’ `core/DEPRECATION.md`
- Gap analysis methodology β†’ `core/GAPS.md` (this file)

---

### 2.5 Specification Gaps (`specs/`)
**Definition:** Missing system-level contracts, security considerations, or amendment processes.

**Examples:**
- Security model doesn't cover new threat vector
- Amendment process unclear for specific change types
- System boundaries undefined for new component
- Git contract doesn't cover specific workflow
- Intent contract missing scenario coverage

**Detection:**
- Security reviews finding uncovered areas
- Amendment requests without clear process
- Cross-system integration ambiguities
- Authority disputes about who owns what

**Routing:**
- Intent/methodology contract gaps β†’ `specs/INTENT.md`
- System definition gaps β†’ `specs/SYSTEM.md`
- Security gaps β†’ `specs/SECURITY.md`
- Git workflow gaps β†’ `specs/GIT.md`
- Change control gaps β†’ `specs/AMENDMENTS.md`

---

### 2.6 Project-Specific Gaps (`.decapod/OVERRIDE.md`)
**Definition:** Gaps between embedded constitution and project needs.

**Examples:**
- Project needs custom priority levels
- Specific subsystem needs different defaults
- Custom validation gates required
- Project-specific methodology additions

**Detection:**
- OVERRIDE.md content doesn't address need
- Project repeatedly working around constitution
- Domain-specific gaps not covered by general docs

**Routing:**
- Project overrides β†’ `.decapod/OVERRIDE.md`

---

## 3. Gap Identification Protocol

### 3.1 Continuous Scanning
Gap identification is not a one-time audit. It happens:
- During every agent session
- When validation fails
- When agents ask clarifying questions
- When workarounds emerge
- When proof surfaces can't validate

### 3.2 Gap Signal Detection

**Strong Signals (definite gaps):**
- `decapod validate` fails with new error
- Two docs contradict each other
- Agent can't determine next step
- Proof surface exists but can't be run
- Schema documented but not implemented

**Medium Signals (likely gaps):**
- Repeated similar questions
- Workarounds documented as "temporary"
- SPEC items without graduation timeline
- Claims marked `not_enforced`
- TODOs without clear resolution path

**Weak Signals (potential gaps):**
- Performance could be better
- UX friction
- Missing "nice to have" features
- Undocumented but working behavior

### 3.3 Gap Triage Questions

When you identify a potential gap, answer:

1. **What layer?** (interface, methodology, plugin, core, spec, project)
2. **What severity?** (blocks work, causes friction, nice to have)
3. **Who owns it?** (which document/subsystem has authority)
4. **Is it known?** (check existing TODOs, issues, docs)
5. **What's the proof?** (how would we know when it's fixed)

---

## 4. Gap Documentation & Routing

### 4.1 Document the Gap

Every identified gap should have:
- **Description:** What is missing/misaligned
- **Category:** Which gap type (Β§2)
- **Evidence:** How you detected it
- **Impact:** What work is blocked or complicated
- **Owner:** Which subsystem/document owns resolution
- **Proof:** How to verify when fixed

### 4.2 Route to Appropriate Subsystem

Use the **routing table** in Β§2 to determine where the gap belongs.

**Decision tree:**
1. Is it a missing/incomplete binding contract? β†’ `interfaces/`
2. Is it unclear how to do something? β†’ `methodology/`
3. Is it missing functionality? β†’ `plugins/` or `core/PLUGINS.md`
4. Is it navigation/routing? β†’ `core/DECAPOD.md`
5. Is it system-level contract? β†’ `specs/`
6. Is it project-specific? β†’ `.decapod/OVERRIDE.md`

### 4.3 Create TODO (if actionable)

If the gap is actionable:
1. Create TODO via `decapod todo add`
2. Tag with appropriate category
3. Reference this GAPS.md section if gap analysis needed
4. Link to relevant subsystem docs

**Example:**
```bash
decapod todo add "Fix gap: CLI schema missing for X command" --priority high
# Add details: Category=interface, Owner=interfaces/DOC_RULES.md
```

### 4.4 Update Relevant Index

If the gap reveals missing coverage in an index file:
- Update `core/INTERFACES.md` if interface gaps
- Update `core/METHODOLOGY.md` if methodology gaps
- Update `core/PLUGINS.md` if plugin gaps

---

## 5. Gap Lifecycle

```
Identify β†’ Categorize β†’ Route β†’ Document β†’ TODO β†’ Resolve β†’ Verify
```

**States:**
- **Identified:** Gap spotted, not yet categorized
- **Categorized:** Layer and type determined
- **Routed:** Owner document/subsystem identified
- **Documented:** Gap described with evidence
- **Ticketed:** TODO created with priority
- **In Progress:** Being addressed
- **Resolved:** Fix implemented
- **Verified:** Proof surface confirms resolution

---

## 6. Gap Analysis Integration with Subsystems

### 6.1 Integration with TODO System

Gap findings often become TODOs:
- High-impact gaps β†’ high-priority TODOs
- Systemic gaps β†’ epics with multiple TODOs
- Methodology gaps β†’ documentation TODOs
- Interface gaps β†’ implementation + doc TODOs

**See:** `plugins/TODO.md` for work tracking

### 6.2 Integration with Validation

Gap detection often triggered by:
- `decapod validate` failures
- Doc graph reachability issues
- Schema mismatches
- Store contamination detection

**Gap findings should:**
- Add validation gates where possible
- Update validate taxonomy
- Document expected vs actual behavior

**See:** `interfaces/CONTROL_PLANE.md` Β§6 for validate doctrine

### 6.3 Integration with Knowledge Base

Gap analysis produces knowledge:
- Why gaps exist (historical context)
- How gaps were resolved (patterns)
- Gap taxonomy and categorization
- Common gap types by subsystem

**See:** `methodology/KNOWLEDGE.md` for knowledge management

### 6.4 Integration with Memory

Agents should remember:
- Gap patterns (avoid repeated gaps)
- Resolution strategies
- Common routing decisions
- Verification approaches

**See:** `methodology/MEMORY.md` for learning patterns

---

## 7. Gap Taxonomy Reference

### 7.1 By Layer

| Layer | Gap Type | Index File |
|-------|----------|------------|
| Interfaces | Missing contracts, schemas, invariants | `core/INTERFACES.md` |
| Methodology | Unclear practices, missing guidance | `core/METHODOLOGY.md` |
| Plugins | Missing functionality, incomplete impl | `core/PLUGINS.md` |
| Core | Routing, navigation, coordination | `core/DECAPOD.md` |
| Specs | System contracts, security, process | `specs/` |
| Project | Project-specific overrides | `.decapod/OVERRIDE.md` |

### 7.2 By Severity

| Severity | Description | Action |
|----------|-------------|--------|
| Critical | Blocks work, violates contracts | Immediate TODO, escalate |
| High | Causes friction, workarounds needed | High-priority TODO |
| Medium | Inconvenience, unclear guidance | Medium-priority TODO |
| Low | Nice to have, optimization | Backlog or knowledge entry |

### 7.3 By Lifecycle Stage

| Stage | Gap Characteristic | Typical Resolution |
|-------|-------------------|-------------------|
| Design | Missing spec for planned feature | Add SPEC docs |
| Implementation | STUB without graduation path | Implement or deprioritize |
| Production | REAL but incomplete | Fix or document limitations |
| Maintenance | Drift from documented behavior | Drift recovery |

---

## 8. Common Gap Patterns

### 8.1 "SPEC Forever"
**Pattern:** Feature marked SPEC with no graduation timeline
**Detection:** Check PLUGINS.md for old SPEC items
**Resolution:** Either implement or downgrade to IDEA

### 8.2 "Documentation Drift"
**Pattern:** Docs say X, code does Y, neither is "wrong" but they differ
**Detection:** Validation warnings, agent confusion
**Resolution:** Drift recovery protocol (see INTENT.md)

### 8.3 "Proof Gap"
**Pattern:** Claim exists in CLAIMS.md but proof surface doesn't verify it
**Detection:** `not_enforced` claims, failing validate
**Resolution:** Implement proof or downgrade claim

### 8.4 "Missing Index"
**Pattern:** Subsystem exists but not in registry
**Detection:** PLUGINS.md doesn't list working subsystem
**Resolution:** Add to appropriate index file

### 8.5 "Interface Mismatch"
**Pattern:** Two subsystems expect different interfaces
**Detection:** Integration failures at boundaries
**Resolution:** Define boundary contract in interfaces/

### 8.6 "Methodology Vacuum"
**Pattern:** Common task has no documented approach
**Detection:** Agents invent different solutions
**Resolution:** Add methodology guide

---

## 9. Gap Analysis for Leadership

### 9.1 Strategic Gap Assessment

Principals and Architects should periodically:
- Review gap distribution by layer
- Identify systemic gap patterns
- Assess gap resolution velocity
- Prioritize gap categories

### 9.2 Gap Metrics

Track:
- Gap identification rate (new gaps per week)
- Gap resolution velocity (time to close)
- Gap severity distribution
- Gap category trends
- Recurring gap patterns

### 9.3 Gap Prevention

Proactive measures:
- Thorough design before implementation
- Proof surfaces for all REAL claims
- Clear methodology documentation
- Regular validation
- Cross-subsystem integration testing

---

## 10. Emergency Gap Protocol

### 10.1 Critical Gap Detected

If you find a gap that:
- Violates security contract
- Causes data loss
- Breaks validation completely
- Creates split-brain state

**Immediate actions:**
1. STOP work
2. Document gap with evidence
3. Notify via appropriate channels
4. Consult `plugins/EMERGENCY_PROTOCOL.md`
5. Create critical TODO
6. Do not proceed until resolved

### 10.2 Authority Escalation

If gap crosses authority boundaries:
- Document the ambiguity
- Propose authority assignment
- Reference `interfaces/DOC_RULES.md` Β§8
- Route to AMENDMENTS.md if needed

---

## 11. Gap Analysis Checklist

**When analyzing system for gaps:**

- [ ] Run `decapod validate` and catalog all warnings
- [ ] Review PLUGINS.md registry vs actual subsystems
- [ ] Check for `STUB`/`SPEC` without graduation path
- [ ] Identify `not_enforced` claims in CLAIMS.md
- [ ] Review recent TODOs for systemic patterns
- [ ] Survey agents for unclear guidance
- [ ] Check for broken/missing links in doc graph
- [ ] Compare OVERRIDE.md to project needs
- [ ] Review emergency protocols for coverage gaps
- [ ] Assess methodology docs for actionable guidance

---

## 12. Gap Resolution Verification

Every resolved gap needs:
- [ ] Proof surface passes
- [ ] Documentation updated
- [ ] Index files current
- [ ] TODO closed with evidence
- [ ] Knowledge entry (if pattern)
- [ ] No new gaps introduced

**Run before claiming resolution:**
```bash
decapod validate
# Must pass completely
```

---

## Links

### Core Router
- `core/DECAPOD.md` - **Router and navigation charter (START HERE)**

### Authority (Constitution Layer)
- `specs/INTENT.md` - **Methodology contract (READ FIRST)**
- `specs/SYSTEM.md` - System definition and authority doctrine
- `specs/SECURITY.md` - Security contract
- `specs/GIT.md` - Git etiquette contract
- `specs/AMENDMENTS.md` - Change control

### Registry (Core Indices)
- `core/PLUGINS.md` - Subsystem registry
- `core/INTERFACES.md` - Interface contracts index
- `core/METHODOLOGY.md` - Methodology guides index
- `core/DEPRECATION.md` - Deprecation contract

### Contracts (Interfaces Layer)
- `interfaces/CONTROL_PLANE.md` - Sequencing patterns and validation doctrine
- `interfaces/DOC_RULES.md` - Doc compilation rules
- `interfaces/CLAIMS.md` - Promises ledger
- `interfaces/GLOSSARY.md` - Term definitions

### Practice (Methodology Layer)
- `methodology/ARCHITECTURE.md` - Architecture practice
- `methodology/SOUL.md` - Agent identity
- `methodology/KNOWLEDGE.md` - Knowledge curation
- `methodology/MEMORY.md` - Memory and learning

### Domain Architecture Patterns
- `architecture/UI.md` - UI architecture patterns and component design
- `architecture/FRONTEND.md` - Frontend architecture patterns
- `architecture/WEB.md` - Web architecture patterns
- `architecture/DATA.md` - Data architecture patterns
- `architecture/SECURITY.md` - Security architecture patterns
- `architecture/CLOUD.md` - Cloud deployment patterns

### Operations (Plugins Layer)
- `plugins/TODO.md` - Work tracking
- `plugins/VERIFY.md` - Validation subsystem
- `plugins/EMERGENCY_PROTOCOL.md` - Emergency protocols

---

## Project Override Context

Current gap themes:
- Integration maturity: some domain adapters are still placeholder-level.
- Verification depth: broaden end-to-end and backend-parity test coverage.
- Runtime ergonomics: improve capability granting, versioning, and visibility of subsystem status.
- Interface completeness: close remaining stubs in automation and extension lifecycle workflows.

Completed themes:
- Stronger sandboxing and tool isolation model.
- Better context handling and background maintenance flows.
- Improved control plane surfaces for channels, routines, and extension management.