MCPcopy Create free account
hub / github.com/SethGammon/Citadel / buildBlocks

Function buildBlocks

core/memory/blocks.js:103–213  ·  view source on GitHub ↗
(projectRoot, options = {})

Source from the content-addressed store, hash-verified

101}
102
103function buildBlocks(projectRoot, options = {}) {
104 const campaignPath = '.planning/campaigns/citadel-competitor-gap-assessment.md';
105 const campaignText = readText(projectRoot, campaignPath);
106 const patternText = readText(projectRoot, '.planning/research/patterns.md');
107 const insightText = readText(projectRoot, '.planning/research/external-insights-brief.md');
108 const packageJson = readText(projectRoot, 'package.json');
109 const decisions = extractDecisionLog(campaignText);
110 const patterns = extractPatternLines(patternText || insightText, 10);
111
112 const fleetOutputs = listFiles(path.join(projectRoot, '.planning', 'fleet'), (file) => /\.(md|json|jsonl)$/.test(file), 10)
113 .map((file) => source(projectRoot, rel(projectRoot, file), 'fleet output or session evidence'));
114 const postmortems = listFiles(path.join(projectRoot, '.planning', 'postmortems'), (file) => file.endsWith('.md'), 10)
115 .map((file) => source(projectRoot, rel(projectRoot, file), 'postmortem evidence'));
116
117 return [
118 block(
119 'memory-project-rules',
120 'project-rules',
121 ['project', 'harness', 'skills', 'hooks'],
122 availableSources(projectRoot, [
123 source(projectRoot, 'AGENTS.md', 'repository operating rules'),
124 source(projectRoot, 'docs/CONSTITUTION.md', 'harness rule hierarchy'),
125 source(projectRoot, 'docs/SKILLS.md', 'skill authoring and handoff contract'),
126 ]),
127 [
128 '- Treat this repository as the Citadel harness; skills, agents, hooks, and state files are first-class product surfaces.',
129 '- Keep changes scoped to harness conventions: skills in `skills/`, agents in `agents/`, hooks in `hooks_src/`, and campaign state in `.planning/`.',
130 '- Every completed task must leave a compact HANDOFF and enough verification evidence for another session to resume.',
131 ].join('\n'),
132 'high',
133 options
134 ),
135 block(
136 'memory-architecture-decisions',
137 'architecture-decisions',
138 ['architecture', 'codex', 'fleet', 'worktree', 'telemetry'],
139 availableSources(projectRoot, [
140 source(projectRoot, 'docs/ARCHITECTURE.md', 'current harness architecture'),
141 source(projectRoot, 'docs/CODEX_NATIVE_INTEGRATIONS.md', 'Codex-native integration decisions'),
142 source(projectRoot, 'docs/FLEET.md', 'fleet coordination design'),
143 source(projectRoot, 'docs/worktree-isolation.md', 'worktree readiness design'),
144 source(projectRoot, campaignPath, 'competitor-gap implementation decisions'),
145 ]),
146 [
147 '- Citadel owns durable campaign memory, discovery relay, scope claims, policy, and evidence even when Codex supplies native execution primitives.',
148 '- Fleet work is dependency-aware: ready work, blocked work, readiness-blocked work, and merge-order blockers are separate operator states.',
149 '- Telemetry and artifact records now carry lineage IDs plus `_hash`; optional HMAC signing upgrades integrity without breaking old legacy records.',
150 ...decisions.slice(-6),
151 ].join('\n'),
152 'high',
153 options
154 ),
155 block(
156 'memory-verification-recipes',
157 'verification-recipes',
158 ['verification', 'tests', 'hooks', 'skills', 'telemetry'],
159 availableSources(projectRoot, [
160 source(projectRoot, 'AGENTS.md', 'required verification table'),

Callers 1

compileMemoryBlocksFunction · 0.85

Calls 8

extractDecisionLogFunction · 0.85
extractPatternLinesFunction · 0.85
sourceFunction · 0.85
relFunction · 0.85
blockFunction · 0.85
availableSourcesFunction · 0.85
readTextFunction · 0.70
listFilesFunction · 0.70

Tested by

no test coverage detected