@mangold/rvault 0.1.0

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 (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/dist/commands/doctor.d.ts +7 -0
  4. package/dist/commands/doctor.d.ts.map +1 -0
  5. package/dist/commands/doctor.js +315 -0
  6. package/dist/commands/doctor.js.map +1 -0
  7. package/dist/commands/init.d.ts +8 -0
  8. package/dist/commands/init.d.ts.map +1 -0
  9. package/dist/commands/init.js +181 -0
  10. package/dist/commands/init.js.map +1 -0
  11. package/dist/commands/run.d.ts +9 -0
  12. package/dist/commands/run.d.ts.map +1 -0
  13. package/dist/commands/run.js +117 -0
  14. package/dist/commands/run.js.map +1 -0
  15. package/dist/commands/status.d.ts +6 -0
  16. package/dist/commands/status.d.ts.map +1 -0
  17. package/dist/commands/status.js +147 -0
  18. package/dist/commands/status.js.map +1 -0
  19. package/dist/commands/upgrade.d.ts +9 -0
  20. package/dist/commands/upgrade.d.ts.map +1 -0
  21. package/dist/commands/upgrade.js +409 -0
  22. package/dist/commands/upgrade.js.map +1 -0
  23. package/dist/commands/version.d.ts +7 -0
  24. package/dist/commands/version.d.ts.map +1 -0
  25. package/dist/commands/version.js +57 -0
  26. package/dist/commands/version.js.map +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +103 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/lib/checksum.d.ts +3 -0
  32. package/dist/lib/checksum.d.ts.map +1 -0
  33. package/dist/lib/checksum.js +11 -0
  34. package/dist/lib/checksum.js.map +1 -0
  35. package/dist/lib/claude.d.ts +22 -0
  36. package/dist/lib/claude.d.ts.map +1 -0
  37. package/dist/lib/claude.js +50 -0
  38. package/dist/lib/claude.js.map +1 -0
  39. package/dist/lib/detect.d.ts +3 -0
  40. package/dist/lib/detect.d.ts.map +1 -0
  41. package/dist/lib/detect.js +28 -0
  42. package/dist/lib/detect.js.map +1 -0
  43. package/dist/lib/files.d.ts +28 -0
  44. package/dist/lib/files.d.ts.map +1 -0
  45. package/dist/lib/files.js +92 -0
  46. package/dist/lib/files.js.map +1 -0
  47. package/dist/lib/manifest-parser.d.ts +6 -0
  48. package/dist/lib/manifest-parser.d.ts.map +1 -0
  49. package/dist/lib/manifest-parser.js +108 -0
  50. package/dist/lib/manifest-parser.js.map +1 -0
  51. package/dist/lib/merge-prompt.d.ts +30 -0
  52. package/dist/lib/merge-prompt.d.ts.map +1 -0
  53. package/dist/lib/merge-prompt.js +113 -0
  54. package/dist/lib/merge-prompt.js.map +1 -0
  55. package/dist/lib/registry.d.ts +6 -0
  56. package/dist/lib/registry.d.ts.map +1 -0
  57. package/dist/lib/registry.js +19 -0
  58. package/dist/lib/registry.js.map +1 -0
  59. package/dist/lib/template.d.ts +7 -0
  60. package/dist/lib/template.d.ts.map +1 -0
  61. package/dist/lib/template.js +22 -0
  62. package/dist/lib/template.js.map +1 -0
  63. package/dist/lib/version-file.d.ts +5 -0
  64. package/dist/lib/version-file.d.ts.map +1 -0
  65. package/dist/lib/version-file.js +21 -0
  66. package/dist/lib/version-file.js.map +1 -0
  67. package/dist/types.d.ts +54 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js +2 -0
  70. package/dist/types.js.map +1 -0
  71. package/package.json +44 -0
  72. package/templates/.claude/agents/vault-adversarial-auditor.md +99 -0
  73. package/templates/.claude/agents/vault-constitutional-reviewer.md +59 -0
  74. package/templates/.claude/agents/vault-contradiction-analyst.md +86 -0
  75. package/templates/.claude/agents/vault-critic.md +73 -0
  76. package/templates/.claude/agents/vault-ideator.md +59 -0
  77. package/templates/.claude/agents/vault-meta-reviewer.md +90 -0
  78. package/templates/.claude/agents/vault-researcher.md +85 -0
  79. package/templates/.claude/agents/vault-synthesizer.md +63 -0
  80. package/templates/.claude/skills/vault/SKILL.md +96 -0
  81. package/templates/.claude/skills/vault-audit/SKILL.md +21 -0
  82. package/templates/.claude/skills/vault-decide/SKILL.md +29 -0
  83. package/templates/.claude/skills/vault-fieldnote/SKILL.md +27 -0
  84. package/templates/.claude/skills/vault-ideas/SKILL.md +24 -0
  85. package/templates/.claude/skills/vault-queue/SKILL.md +28 -0
  86. package/templates/.claude/skills/vault-review/SKILL.md +35 -0
  87. package/templates/.claude/skills/vault-status/SKILL.md +23 -0
  88. package/templates/BOOTSTRAP.md +77 -0
  89. package/templates/infrastructure.json +38 -0
  90. package/templates/research-vault/VAULT_CONSTITUTION.md +307 -0
  91. package/templates/research-vault/VAULT_PROTOCOL.md +432 -0
  92. package/templates/research-vault/archive/.gitkeep +0 -0
  93. package/templates/research-vault/decision-briefs/.gitkeep +0 -0
  94. package/templates/research-vault/distilled/.gitkeep +0 -0
  95. package/templates/research-vault/governance/DESIGN_ORIGINS.md +214 -0
  96. package/templates/research-vault/ideas/.gitkeep +0 -0
  97. package/templates/research-vault/inbox/.gitkeep +0 -0
  98. package/templates/research-vault/integrated/.gitkeep +0 -0
  99. package/templates/research-vault/logs/.gitkeep +0 -0
  100. package/templates/research-vault/project-context/.gitkeep +0 -0
  101. package/templates/research-vault/project-context/FIELD_NOTES.md +28 -0
  102. package/templates/research-vault/project-context/REFERENCES.md +48 -0
  103. package/templates/research-vault/research-queue/briefs/.gitkeep +0 -0
@@ -0,0 +1,432 @@
1
+ # Research Vault Protocol
2
+
3
+ > **Purpose**: Convert idle coding-agent capacity into durable, decision-ready intellectual capital through autonomous research, synthesis, and self-critique — with minimal human supervision.
4
+
5
+ > **Safety envelope**: Agents operating under this protocol MAY perform web searches, read project files, and write to the vault directory. They MUST NOT modify project source code, run arbitrary executables, or access sensitive credentials. All outputs are markdown files in the vault tree.
6
+
7
+ > **Governance**: This protocol is subordinate to `VAULT_CONSTITUTION.md`. The constitution defines inviolable principles, the amendment process, and roles (such as the Constitutional Reviewer) that oversee this protocol's soundness. Read the constitution first.
8
+
9
+ ---
10
+
11
+ ## 1. Directory Structure
12
+
13
+ ```
14
+ research-vault/
15
+ ├── VAULT_CONSTITUTION.md ← read first, always — governs the protocol
16
+ ├── VAULT_PROTOCOL.md ← operational procedures (subordinate to constitution)
17
+ ├── MANIFEST.md ← live index of all vault state
18
+ ├── governance/
19
+ │ └── DESIGN_ORIGINS.md ← founding motivations and design rationale
20
+ ├── project-context/
21
+ │ ├── GOALS.md
22
+ │ ├── PROBLEMS.md
23
+ │ ├── DECISIONS.md
24
+ │ ├── REFERENCES.md ← local reference document manifest
25
+ │ └── FIELD_NOTES.md ← development feedback for vault agents
26
+ ├── research-queue/
27
+ │ ├── QUEUE.md
28
+ │ └── briefs/
29
+ │ └── YYYY-MM-DD_<slug>.md
30
+ ├── inbox/
31
+ │ └── YYYY-MM-DD_<slug>/
32
+ │ ├── report.md
33
+ │ ├── provenance.md
34
+ │ └── pre-brief.md
35
+ ├── distilled/
36
+ │ └── YYYY-MM-DD_<slug>.md
37
+ ├── integrated/
38
+ │ ├── <concern-slug>.md
39
+ │ └── CONTRADICTIONS.md
40
+ ├── decision-briefs/
41
+ │ └── <decision-slug>.md
42
+ ├── ideas/
43
+ │ └── YYYY-MM-DD_<slug>.md
44
+ ├── archive/
45
+ │ └── ...
46
+ └── logs/
47
+ ├── activity.log
48
+ ├── session-YYYY-MM-DD-HHMMSS.md
49
+ └── constitutional-review-YYYY-MM-DD.md
50
+ ```
51
+
52
+ ### Naming conventions
53
+ - Dates: `YYYY-MM-DD` prefix for chronological sorting.
54
+ - Slugs: lowercase, hyphen-separated, ≤40 chars. Descriptive of content.
55
+ - All files are UTF-8 markdown unless otherwise noted.
56
+
57
+ ---
58
+
59
+ ## 2. Agent Roles
60
+
61
+ Each role is a **hat** — the same underlying agent (e.g., Claude Code) assumes a role by reading the relevant section below. Multiple roles can run in parallel where noted.
62
+
63
+ ### 2.1 Researcher
64
+ **Trigger**: Items exist in `research-queue/QUEUE.md` with status `pending`.
65
+ **Inputs**: A queue entry + the corresponding pre-brief.
66
+ **Process**:
67
+ 1. Read the pre-brief to understand scope and relevance.
68
+ 2. Check `project-context/REFERENCES.md` for local reference documents relevant to the topic. Search within them before web searches — local references are authoritative primary sources.
69
+ 3. Conduct web searches. Aim for 3–8 high-quality sources per topic.
70
+ 4. Write a structured report to `inbox/YYYY-MM-DD_<slug>/report.md`.
71
+ 5. Write `provenance.md` (original prompt, search queries used, source URLs, timestamps).
72
+ 6. Copy the pre-brief into the report directory.
73
+ 7. Update `QUEUE.md`: set status to `researched`. Update `MANIFEST.md`.
74
+ 8. Append to `logs/activity.log`. If this topic is tagged `meta`, include the tag `[meta]` in the log entry (e.g., `[meta] Researched: <topic>`). This tag is used to compute meta-research compliance.
75
+ 9. Update the relevant Cycle Counters in MANIFEST.md. Increment `Total research sessions completed`, `Sessions since last meta-review`, and `Sessions since last constitutional review`. Each researcher execution counts as one research session — if 3 researchers run in parallel, the total increments by 3. In orchestrated parallel mode, the orchestrator handles counter increments; the researcher skips counter updates and reports changes in `logs/activity.log` instead.
76
+
77
+ **Report structure**:
78
+ ```markdown
79
+ # <Topic Title>
80
+ ## Summary (3-5 sentences)
81
+ ## Key Findings (bulleted, each tagged with confidence: high/medium/low)
82
+ ## Sources (numbered, with URL and retrieval date)
83
+ ## Open Questions (what this report does NOT answer)
84
+ ## Relevance to Project (how this connects to GOALS.md / PROBLEMS.md)
85
+ ```
86
+
87
+ **Parallelism**: ✅ Fully parallel. Multiple researchers can run simultaneously on different queue items. Use unique directory names (timestamp + slug) to avoid collisions.
88
+
89
+ ### 2.2 Critic
90
+ **Trigger**: Reports exist in `inbox/` that have not yet been distilled (check `MANIFEST.md`).
91
+ **Inputs**: One raw report + `project-context/GOALS.md` + `project-context/PROBLEMS.md`. When a report makes claims about the project's own code, hardware, or configuration, the project source code is a valid and preferred source of ground truth. Read the relevant source files to verify — do not take the report's word for implementation details.
92
+ **Process**:
93
+ 1. Evaluate the report against its own pre-brief: did it answer the stated question?
94
+ 2. Assess relevance to current project goals. Score: `critical / relevant / tangential / off-topic`.
95
+ 3. **Impact test**: Answer the question: "If this finding were removed from the vault entirely, what decision or action would be affected?" Document the answer. If the answer is "none," "unclear," or only vaguely connected to a goal, flag the report for deprioritization regardless of its quality score. Record the flag in the distilled finding under a `## Impact` section.
96
+ 4. Assess quality: are sources credible? Are claims supported? Any logical gaps? Where claims reference project internals (packet formats, pin assignments, control loop behavior), verify against source code.
97
+ 5. Extract the 3–5 most important claims. Tag each with confidence level.
98
+ 6. Flag any claims that contradict existing content in `integrated/` or `distilled/`.
99
+ 7. Write a distilled finding to `distilled/YYYY-MM-DD_<slug>.md`.
100
+ 8. If relevance is `off-topic`, note this prominently and recommend archival.
101
+ 9. Update `MANIFEST.md`. Append to `logs/activity.log`.
102
+ 10. Update the relevant Cycle Counters in MANIFEST.md. Increment `Reports distilled since last synthesis`.
103
+
104
+ **Distilled finding structure**:
105
+ ```markdown
106
+ # <Topic Title> — Distilled
107
+ ## Relevance: <critical|relevant|tangential|off-topic>
108
+ ## Key Claims
109
+ - Claim 1 (confidence: high) — [source]
110
+ - Claim 2 (confidence: medium) — [source]
111
+ ## Contradictions (if any)
112
+ - Contradicts: <reference to existing integrated knowledge>
113
+ - Assessment: <which claim has stronger evidence and why>
114
+ ## Impact
115
+ - Decision/action affected: <specific decision or "none/unclear">
116
+ - Deprioritization flag: <yes/no>
117
+ ## Recommendation
118
+ <What to do with this: integrate, investigate further, archive, discard>
119
+ ```
120
+
121
+ **Parallelism**: ✅ Parallel per-report. Each critic instance works on one report independently.
122
+
123
+ ### 2.3 Synthesizer
124
+ **Trigger**: ≥3 distilled findings exist that have not been integrated (check `Reports distilled since last synthesis` in MANIFEST.md Cycle Counters), OR a scheduled synthesis cycle is due.
125
+ **Inputs**: All un-integrated distilled findings + all current `integrated/*.md` files + `project-context/`.
126
+ **Process**:
127
+ 1. Read all pending distilled findings.
128
+ 2. For each, determine which project concern it belongs to (reference `GOALS.md`, `PROBLEMS.md`).
129
+ 3. Merge findings into the appropriate `integrated/<concern>.md` file:
130
+ - Add new knowledge with source attribution and date.
131
+ - Remove or archive superseded claims.
132
+ - Preserve the strongest version of each claim (prefer higher-confidence, more recent).
133
+ 4. Update `integrated/CONTRADICTIONS.md` if new conflicts are found.
134
+ 5. Mark distilled findings as integrated in `MANIFEST.md`.
135
+ 6. Move corresponding `inbox/` reports to `archive/` if all their findings are now integrated.
136
+ 7. Append to `logs/activity.log`.
137
+ 8. Update the relevant Cycle Counters in MANIFEST.md. Reset `Reports distilled since last synthesis` to 0. Increment `Findings integrated since last ideation` by the number of distilled findings processed this session (not by 1).
138
+
139
+ **Integrated knowledge structure** (per concern file):
140
+ ```markdown
141
+ # <Concern Title>
142
+ ## Current Understanding (last updated: YYYY-MM-DD)
143
+ <Narrative summary, 1-3 paragraphs>
144
+ ## Key Claims
145
+ - Claim (confidence, date, source chain)
146
+ ## Open Questions
147
+ ## Related Concerns
148
+ ```
149
+
150
+ **Parallelism**: ⚠️ Sequential recommended. Multiple synthesizers writing to the same concern file will conflict. If parallelizing, partition by concern (each synthesizer owns different concern files).
151
+
152
+ ### 2.4 Contradiction Analyst
153
+ **Trigger**: `integrated/CONTRADICTIONS.md` has unresolved entries, OR the synthesizer flagged new contradictions.
154
+ **Inputs**: The contradicting claims + their source reports + any additional web research needed. Project source code is a valid and preferred source of ground truth when contradictions involve claims about the project's own implementation. Read the relevant source files to resolve factual disputes — code trumps reports.
155
+ **Process**:
156
+ 1. For each unresolved contradiction, assess evidence strength on both sides.
157
+ 2. If resolvable: recommend which claim to retain, with justification. Update the integrated file.
158
+ 3. If not resolvable: document the disagreement clearly, note what evidence would resolve it, and add a targeted research topic to `research-queue/QUEUE.md`.
159
+ 4. Update `CONTRADICTIONS.md`. Append to `logs/activity.log`.
160
+ 5. Update MANIFEST.md: add to recent activity and update the queue status table if new topics were added. The contradiction analyst does not increment or reset any cycle counter.
161
+
162
+ **Parallelism**: ✅ Parallel per-contradiction (as long as each instance works on different contradictions).
163
+
164
+ ### 2.5 Ideator
165
+ **Trigger**: Scheduled ideation cycle, OR ≥5 new findings integrated since last ideation run (check `Findings integrated since last ideation` counter in MANIFEST.md Cycle Counters).
166
+ **Inputs**: Recent distilled and integrated knowledge + `project-context/GOALS.md` + `project-context/PROBLEMS.md`.
167
+ **Process**:
168
+ 1. Scan recent findings for unexpected connections — especially cross-domain links.
169
+ 2. For each idea, write a short proposal to `ideas/YYYY-MM-DD_<slug>.md`:
170
+ - The connection observed.
171
+ - Why it might matter for the project.
172
+ - A concrete next step or experiment to test it.
173
+ - What evidence would confirm or refute it.
174
+ 3. Review existing ideas: any that are now supported or refuted by new evidence should be updated.
175
+ 4. Append to `logs/activity.log`.
176
+ 5. Update the relevant Cycle Counters in MANIFEST.md. Reset `Findings integrated since last ideation` to 0.
177
+
178
+ **Idea structure**:
179
+ ```markdown
180
+ # Idea: <Title>
181
+ ## Connection
182
+ <What findings or knowledge items prompted this>
183
+ ## Hypothesis
184
+ <The speculative claim>
185
+ ## Relevance to Project
186
+ <Which goal or problem this serves>
187
+ ## Proposed Test
188
+ <How to validate — could be more research, a prototype, an experiment>
189
+ ## Falsification Criteria
190
+ <What evidence would kill this idea>
191
+ ```
192
+
193
+ **Parallelism**: ✅ Fully parallel. Multiple ideators can run; duplicates are cheap to detect and merge.
194
+
195
+ ### 2.6 Meta-Reviewer (Vault Health)
196
+ **Trigger**: Scheduled review cycle (check `Sessions since last meta-review` in MANIFEST.md Cycle Counters; trigger when ≥5).
197
+ **Inputs**: The entire vault state — `MANIFEST.md`, all integrated knowledge, the queue, activity logs.
198
+ **Process**:
199
+ 1. **Scope drift check**: Is recent research aligned with `GOALS.md`? Quantify: what fraction of last N reports scored `critical` or `relevant` vs. `tangential` or `off-topic`?
200
+ 2. **Diminishing returns check**: Are recent reports on topic X producing new claims, or just confirming what's already integrated? If converged, deprioritize in queue.
201
+ 3. **Coverage gap check**: Are any items in `PROBLEMS.md` under-researched relative to their priority?
202
+ 4. **Vault hygiene**: Flag stale content (>30 days un-referenced), oversized files, orphaned reports. Archive inbox reports older than 30 days that were never distilled, with a note "Archived by meta-reviewer: undistilled after 30 days."
203
+ 5. **Decision brief drafting**: If any topic has enough integrated knowledge to support a decision, draft a brief in `decision-briefs/` presenting the options, tradeoffs, and the meta-reviewer's recommendation. This is a proposal for the human, not a commitment.
204
+ 6. **Human advisory**: Write a summary for the human supervisor:
205
+ - What's going well.
206
+ - What's drifting or stale.
207
+ - Recommended priority changes for `QUEUE.md`.
208
+ - Any decisions that are now well-enough informed to make.
209
+ 7. Place the advisory in `logs/session-YYYY-MM-DD-HHMMSS.md` and update `MANIFEST.md`.
210
+ 8. Update the relevant Cycle Counters in MANIFEST.md. Reset `Sessions since last meta-review` to 0.
211
+
212
+ **Parallelism**: 🚫 Sequential. Only one meta-reviewer at a time (reads and potentially modifies global state).
213
+
214
+ ### 2.7 Constitutional Reviewer
215
+
216
+ This role is defined and governed by `VAULT_CONSTITUTION.md`, Article III §3.2. It is summarized here for completeness:
217
+
218
+ **Trigger**: Every 10–15 research sessions (check `Sessions since last constitutional review` in MANIFEST.md Cycle Counters; trigger when ≥10), or on human request, or when the Meta-Reviewer flags systemic issues that operational roles cannot resolve.
219
+
220
+ **Purpose**: Evaluate whether the protocol itself is sound, coherent, and aligned with the constitution and the human's original design intent. Reads `governance/DESIGN_ORIGINS.md` as primary evidence of intent.
221
+
222
+ **Outputs**: Constitutional review report in `logs/constitutional-review-YYYY-MM-DD.md`.
223
+
224
+ **Post-process**: Update the relevant Cycle Counters in MANIFEST.md. Reset `Sessions since last constitutional review` to 0.
225
+
226
+ **Parallelism**: 🚫 Sequential. Only one constitutional reviewer at a time. Must not run concurrently with the Meta-Reviewer.
227
+
228
+ For the full process specification, see the constitution.
229
+
230
+ ---
231
+
232
+ ## 3. Workflows
233
+
234
+ ### 3.1 Research Cycle (the default loop)
235
+
236
+ ```
237
+ Human sets GOALS.md, PROBLEMS.md, and seeds QUEUE.md
238
+
239
+
240
+ ┌──────────────────────────┐
241
+ │ Pre-brief (per topic) │ Agent writes justification for each queue item
242
+ └────────────┬─────────────┘
243
+
244
+
245
+ ┌──────────────────────────┐
246
+ │ Research (parallel) │ N agents execute queue items simultaneously
247
+ └────────────┬─────────────┘
248
+
249
+
250
+ ┌──────────────────────────┐
251
+ │ Critique (parallel) │ Per-report quality + relevance assessment
252
+ └────────────┬─────────────┘
253
+
254
+
255
+ ┌──────────────────────────┐
256
+ │ Synthesis (sequential) │ Merge findings into integrated knowledge
257
+ └────────────┬─────────────┘
258
+
259
+
260
+ ┌────────────┴─────────────┐
261
+ │ Ideation │ Contradict.│ Can run in parallel with each other
262
+ │ (parallel) │ Analysis │
263
+ └────────────┬─────────────┘
264
+
265
+
266
+ ┌──────────────────────────┐
267
+ │ Meta-Review (periodic) │ Vault health, scope drift, human advisory
268
+ └──────────────────────────┘
269
+ ```
270
+
271
+ ### 3.2 Quick-Burn Session (maximize token usage in limited time)
272
+
273
+ When the human has, say, 70% of a rate window remaining and is stepping away:
274
+
275
+ 1. **Human**: Review `QUEUE.md`, adjust priorities if desired. Or just say "run the vault."
276
+ 2. **Launch N parallel researchers** on the top N queue items.
277
+ 3. **As reports land in inbox**, launch parallel critics immediately (don't wait for all research to finish).
278
+ 4. **Once ≥3 distilled findings exist**, launch one synthesizer.
279
+ 5. **Concurrently with synthesis**, launch an ideator on the already-distilled findings.
280
+ 6. **If tokens remain**, loop: check queue for more items, or have the meta-reviewer run and suggest new research topics to add to the queue, then research those.
281
+
282
+ **Approximate token budget** (rough, will vary):
283
+ | Role | Tokens per execution | Parallelism |
284
+ |------|---------------------|-------------|
285
+ | Pre-brief | ~500–1K | Parallel |
286
+ | Researcher | ~3K–8K (depends on search depth) | Parallel |
287
+ | Critic | ~1K–3K | Parallel |
288
+ | Synthesizer | ~2K–5K | Sequential |
289
+ | Ideator | ~1K–3K | Parallel |
290
+ | Meta-Reviewer | ~2K–5K | Sequential |
291
+
292
+ ### 3.3 Human Re-entry
293
+
294
+ When the human returns:
295
+
296
+ 1. Read the latest `logs/session-*.md` for the meta-reviewer's advisory.
297
+ 2. Scan `decision-briefs/` for any decisions that are now well-informed.
298
+ 3. Review `ideas/` for anything exciting.
299
+ 4. Adjust `GOALS.md`, `PROBLEMS.md`, `QUEUE.md` as needed.
300
+ 5. Optionally promote an idea to a queue item, or a decision brief to an actual project decision in `DECISIONS.md`.
301
+ 6. If you did implementation work since your last vault interaction, append a field note to `project-context/FIELD_NOTES.md` describing what you tried and what happened. Or use `/vault-fieldnote`.
302
+
303
+ ---
304
+
305
+ ## 4. MANIFEST.md Specification
306
+
307
+ The manifest is the coordination hub. All agents read and update it.
308
+
309
+ ```markdown
310
+ # Vault Manifest
311
+ Last updated: YYYY-MM-DD HH:MM UTC
312
+
313
+ ## Queue Status
314
+ | Topic | Status | Priority | Pre-brief | Tag |
315
+ |-------|--------|----------|-----------|-----|
316
+ | topic-slug | pending/in-progress/researched/distilled/integrated/archived | 1-5 | yes/no | meta or — |
317
+
318
+ ## Recent Activity (last 10 entries)
319
+ - YYYY-MM-DD HH:MM — Role: <role> — Action: <what was done>
320
+
321
+ ## Cycle Counters
322
+ - Total research sessions completed: <N>
323
+ - Reports distilled since last synthesis: <N>
324
+ - Findings integrated since last ideation: <N>
325
+ - Sessions since last meta-review: <N>
326
+ - Sessions since last constitutional review: <N>
327
+ - Meta-research compliance (last 10 sessions): <computed>
328
+ (DO NOT maintain this as a running counter. Compute it fresh
329
+ each time by counting meta-tagged research entries in the last
330
+ 10 sessions from activity.log. The orchestrator and meta-reviewer
331
+ compute this; other roles do not need to update it.)
332
+
333
+ ## Vault Health
334
+ - Total reports: N (inbox: X, distilled: Y, integrated: Z, archived: W)
335
+ - Unresolved contradictions: N
336
+ - Last meta-review: YYYY-MM-DD
337
+ - Coverage gaps: <list or "none identified">
338
+ ```
339
+
340
+ **Concurrency note**: When the orchestrator dispatches multiple parallel agents, the orchestrator owns all MANIFEST.md updates. Individual agents skip their manifest update step and instead report their changes in `logs/activity.log`, which the orchestrator reads when consolidating the manifest at session end. When an agent runs alone (not orchestrated in parallel), it updates the manifest itself per the standard role process.
341
+
342
+ In the rare case of a write conflict, the next agent to run can reconcile. Lost updates are recoverable from `logs/activity.log`.
343
+
344
+ ---
345
+
346
+ ## 5. Quality Controls
347
+
348
+ ### 5.1 Relevance gate
349
+ No research begins without a pre-brief that ties the topic to a specific entry in `GOALS.md` or `PROBLEMS.md`. If the connection is weak, the agent should note this and flag it for human approval rather than proceeding.
350
+
351
+ ### 5.2 Diminishing returns detection
352
+ If the last 3 reports on a topic produced no new claims beyond what's already integrated, the topic is marked `converged` in the queue and deprioritized. The meta-reviewer enforces this.
353
+
354
+ ### 5.3 Contradiction register
355
+ Contradictions are never silently resolved. They are always documented in `CONTRADICTIONS.md` with the evidence assessment. The human has final say on which claim wins if evidence is balanced.
356
+
357
+ ### 5.4 Staleness policy
358
+ - Integrated knowledge older than 90 days without corroboration or reference: flagged for re-verification.
359
+ - Inbox reports older than 30 days that were never distilled: the meta-reviewer archives them with a note "Archived by meta-reviewer: undistilled after 30 days."
360
+ - Decision briefs acted upon: moved to `project-context/DECISIONS.md` with outcome.
361
+
362
+ ### 5.5 Scope creep detection
363
+ The meta-reviewer computes a rolling relevance ratio: (critical + relevant reports) / (total reports) over the last N sessions. If this drops below 0.6, it triggers a human advisory recommending queue pruning.
364
+
365
+ ---
366
+
367
+ ## 6. Bootstrapping
368
+
369
+ To initialize the vault for a new project:
370
+
371
+ 1. Create the directory structure above.
372
+ 2. Write `GOALS.md`: 3–7 ranked project goals.
373
+ 3. Write `PROBLEMS.md`: known open questions or blockers.
374
+ 4. Seed `QUEUE.md` with 5–15 initial research topics, each with a priority 1–5.
375
+ 5. Write pre-briefs for the top 5 topics.
376
+ 6. Run the first research cycle.
377
+
378
+ The vault is self-sustaining after bootstrapping: the meta-reviewer and ideator will suggest new research topics, the synthesizer will maintain integrated knowledge, and the critic will prune irrelevant work.
379
+
380
+ ---
381
+
382
+ ## 7. Agent Instructions (copy-paste for agent prompt)
383
+
384
+ When instructing a coding agent to work on the vault, use a prompt like:
385
+
386
+ ```
387
+ You are operating the Research Vault for this project.
388
+
389
+ Read these documents in order:
390
+ 1. `research-vault/VAULT_CONSTITUTION.md` (governing principles)
391
+ 2. `research-vault/VAULT_PROTOCOL.md` (operational procedures)
392
+ 3. `research-vault/MANIFEST.md` (current state)
393
+
394
+ The constitution governs the protocol. If you encounter a conflict
395
+ between them, follow the constitution and document the conflict in
396
+ the activity log.
397
+
398
+ Your role this session: <ROLE NAME>
399
+
400
+ Follow the process for your role exactly. Update MANIFEST.md and
401
+ activity.log when done. Do not modify any project source code.
402
+ Only write to the research-vault/ directory.
403
+
404
+ If you encounter ambiguity about scope or relevance, err on the
405
+ side of documenting your uncertainty rather than guessing.
406
+ ```
407
+
408
+ For a quick-burn parallel session:
409
+
410
+ ```
411
+ You are operating the Research Vault. Read the constitution first,
412
+ then the protocol, then the manifest. Execute the Quick-Burn
413
+ workflow (protocol §3.2). You may assume <N> parallel agents are
414
+ available. Prioritize breadth of research first, then shift to
415
+ critique and synthesis as reports accumulate. Stop when you have
416
+ exhausted the queue or run low on capacity.
417
+
418
+ Reminder: at least 10% of research cycles must be allocated to
419
+ meta-research topics (tagged `meta` in the queue). See
420
+ constitution Article V.
421
+ ```
422
+
423
+ ---
424
+
425
+ ## 8. Design Principles
426
+
427
+ 1. **Compression over accumulation.** The vault's value is in T2–T3 outputs, not raw reports. Prune aggressively.
428
+ 2. **Provenance is mandatory.** Every claim traces back to a source, a date, and a confidence level. No orphan assertions.
429
+ 3. **Contradiction is signal, not failure.** Disagreements between reports mean the topic is under-determined. Investigate, don't suppress.
430
+ 4. **Human-in-the-loop for decisions, not for research.** Agents research and synthesize autonomously. Humans set goals, resolve ties, and act on decision briefs.
431
+ 5. **Parallel by default, sequential when necessary.** Only synthesis and meta-review require serialization. Everything else can run concurrently.
432
+ 6. **Fail toward documentation.** When uncertain, write down the uncertainty rather than making a silent judgment call. The next agent (or the human) can resolve it.
File without changes
File without changes
@@ -0,0 +1,214 @@
1
+ # Vault Design Origins
2
+
3
+ > This document records the motivations, design decisions, and
4
+ > governing philosophy behind the Research Vault system. It was
5
+ > assembled from the founding conversation between the human
6
+ > supervisor and Claude (Opus 4.6), March 2026. The constitutional
7
+ > reviewer should treat this as primary evidence of human intent
8
+ > when evaluating whether the vault's operation has drifted from
9
+ > its purpose.
10
+
11
+ ---
12
+
13
+ ## 1. The Motivating Problem
14
+
15
+ The human supervisor maintains subscriptions to coding agents
16
+ (primarily Claude Code on the Anthropic Max plan) that provide
17
+ substantial token budgets on rolling windows (e.g., 5-hour usage
18
+ periods). In practice, these tokens frequently go unused because:
19
+
20
+ - The supervisor works a full-time job five days per week and is
21
+ often too fatigued in the evenings to direct agent work.
22
+ - Weekends are consumed by life maintenance, leaving little time
23
+ for project work.
24
+ - Ideas are abundant when energy is high but there is no
25
+ mechanism to capitalize on available capacity during low-energy
26
+ or away-from-desk periods.
27
+ - The result is a persistent feeling of wasted subscription value
28
+ — the capacity exists but decays unused.
29
+
30
+ **The vault exists to solve this specific problem**: converting
31
+ idle agent capacity into durable intellectual capital that
32
+ compounds over time, so that when the human *does* engage, they
33
+ start from a higher baseline rather than from scratch.
34
+
35
+ ---
36
+
37
+ ## 2. The Sleep Consolidation Metaphor
38
+
39
+ The human explicitly compared the vault to the brain's offline
40
+ consolidation during sleep: the automatic process of correlating
41
+ experiences, pruning noise, strengthening important connections,
42
+ and surfacing insights — all without conscious supervision.
43
+
44
+ This metaphor is not decorative. It implies specific design
45
+ requirements:
46
+
47
+ - **Autonomous operation**: The vault must be able to run
48
+ productively without the human present.
49
+ - **Compression, not accumulation**: Just as sleep consolidation
50
+ reduces the day's experiences into durable memory, the vault
51
+ must reduce raw research into integrated knowledge. Volume
52
+ growth without compression is a failure state.
53
+ - **Correlation as a first-class activity**: Agents should
54
+ actively look for connections between findings, not just file
55
+ them independently. The Ideator role exists for this reason.
56
+ - **Low re-entry cost**: When the human returns, they should be
57
+ able to understand what happened and what matters quickly (via
58
+ session logs and decision briefs), analogous to waking up with
59
+ consolidated understanding rather than a pile of raw notes.
60
+
61
+ ---
62
+
63
+ ## 3. The Trust Problem
64
+
65
+ The deeper motivation behind the governance layer (the
66
+ constitution, constitutional reviewer, etc.) is **trust**. The
67
+ human needs to be able to trust the vault's outputs enough to act
68
+ on them without re-verifying everything from scratch. If every
69
+ re-engagement requires the human to audit all work done in their
70
+ absence, the vault has failed — it has merely displaced effort
71
+ rather than reducing it.
72
+
73
+ Trust is built by:
74
+
75
+ - Transparent provenance (every claim traceable to a source).
76
+ - Adversarial self-correction (agents that critique each other).
77
+ - Process governance (the constitutional reviewer checking whether
78
+ the rules themselves are sound).
79
+ - Honest self-assessment (the vault recommending its own
80
+ downsizing if it's not producing value — failure mode F10).
81
+
82
+ ---
83
+
84
+ ## 4. Key Design Decisions and Their Rationale
85
+
86
+ ### 4.1 Tiered compression (T0 → T3)
87
+
88
+ Raw reports (T0) are working memory. Distilled findings (T1) are
89
+ reviewed extracts. Integrated knowledge (T2) is the living
90
+ understanding organized by project concern. Decision briefs (T3)
91
+ are the human-facing actionable outputs.
92
+
93
+ **Rationale**: Without explicit tiers, research accumulates as a
94
+ write-only knowledge base. The human identified "too much text"
95
+ and "noise for the repo" as primary concerns early in the design
96
+ conversation. The tiers enforce that every piece of research must
97
+ be compressed before it earns a permanent place.
98
+
99
+ ### 4.2 Council of agents (single agent, multiple roles)
100
+
101
+ Rather than a monolithic agent process, the system uses distinct
102
+ roles (Researcher, Critic, Synthesizer, etc.) that the same
103
+ underlying agent assumes at different times.
104
+
105
+ **Rationale**: The human proposed a "council of agents" where
106
+ "one agent wearing different hats" would critique research in
107
+ different ways. This maps to the multi-agent debate pattern
108
+ (Du et al., 2023) which empirically improves factual accuracy.
109
+ The role separation ensures that the agent that *produced*
110
+ research is not the same cognitive frame that *evaluates* it.
111
+
112
+ ### 4.3 Constitution separate from protocol
113
+
114
+ The constitution is a short, principled, stable document. The
115
+ protocol is a longer operational manual. The constitution governs
116
+ the protocol, not the other way around.
117
+
118
+ **Rationale**: The human raised the concern that self-correcting
119
+ agents following a fixed protocol could still drift if the
120
+ protocol itself becomes misaligned. The constitution provides a
121
+ stable reference point against which the protocol is periodically
122
+ evaluated. The separation also creates appropriate friction:
123
+ changing a workflow step should be easy; changing a governing
124
+ principle should be deliberate.
125
+
126
+ ### 4.4 Human-as-ratifier (not human-as-operator)
127
+
128
+ Agents propose amendments and surface decisions. The human
129
+ approves, rejects, or modifies. The human is compared to a
130
+ president who signs or vetoes bills.
131
+
132
+ **Rationale**: The human explicitly stated that agents should not
133
+ autonomously change the governing documents. This is the one
134
+ hard firewall against drift. The human does not need to *direct*
135
+ every action, but they must *approve* every structural change.
136
+
137
+ ### 4.5 Parallelization by design
138
+
139
+ The system is designed so that most roles can run concurrently.
140
+ Research is embarrassingly parallel. Critique is parallel per-
141
+ report. Synthesis is the sequential bottleneck.
142
+
143
+ **Rationale**: The motivating problem is token utilization. If
144
+ the human has 70% of a rate window remaining, they want to burn
145
+ through it productively. Sequential processing wastes capacity.
146
+ The lock-free coordination model (unique filenames, no shared
147
+ mutable state except the manifest) enables parallel execution
148
+ without complex synchronization.
149
+
150
+ ### 4.6 Protected meta-research (10% floor)
151
+
152
+ At least 10% of research cycles are reserved for meta-research
153
+ about the vault methodology itself. This allocation cannot be
154
+ deprioritized by operational roles.
155
+
156
+ **Rationale**: The human identified this as a potential solution
157
+ to the governance problem: "maybe the solution is to just make
158
+ it another research topic." The protected floor ensures it
159
+ actually happens rather than being perpetually deferred in favor
160
+ of project-specific research.
161
+
162
+ ---
163
+
164
+ ## 5. Failure Modes the Human Is Most Concerned About
165
+
166
+ In order of emphasis during the design conversation:
167
+
168
+ 1. **Noise accumulation** — too much text, reports that disagree
169
+ or confuse rather than clarify.
170
+ 2. **Coherent drift** — everything working correctly according
171
+ to rules that no longer serve the project.
172
+ 3. **Process overhead exceeding value** — the vault becoming
173
+ bureaucratic busywork.
174
+ 4. **Agents unable to follow the protocol correctly** — the
175
+ documents being too ambiguous or too complex for coding agents
176
+ to interpret reliably.
177
+ 5. **Self-preservation bias** — the vault continuing to justify
178
+ its own existence when tokens would be better spent on direct
179
+ implementation.
180
+
181
+ ---
182
+
183
+ ## 6. Long-Term Vision
184
+
185
+ The human intends to deploy a vault for every active project,
186
+ including work projects, if this first instance proves valuable.
187
+ This implies:
188
+
189
+ - The system must be lightweight enough to justify per-project
190
+ overhead.
191
+ - The constitution and protocol should be project-agnostic (they
192
+ are — project specifics live in `project-context/`).
193
+ - Lessons learned from this first vault should be captured and
194
+ transferable.
195
+ - Success criteria: the human feels that re-engagement after
196
+ absence is *easier* with the vault than without it, and that
197
+ decisions are better-informed.
198
+
199
+ ---
200
+
201
+ ## 7. What Would Change the Human's Assessment
202
+
203
+ The human would likely reconsider the vault approach if:
204
+
205
+ - The overhead of maintaining vault structure exceeds ~40% of
206
+ total token usage without proportional improvement in output
207
+ quality.
208
+ - Integrated knowledge is frequently wrong or misleading,
209
+ requiring the human to re-verify most claims anyway.
210
+ - The system produces research that feels productive but doesn't
211
+ translate into project decisions or code changes.
212
+ - Re-entry cost remains high despite the vault's operation (the
213
+ session logs and decision briefs aren't actually reducing the
214
+ time to get oriented).
File without changes
File without changes
File without changes
File without changes