Skip to content

Commit d7c3b72

Browse files
stonks-gitclaude
andcommitted
Wire BootstrapReadiness into cognitive loop (WIRE-002)
- Persistent BootstrapReadiness instance in loop - check_all() runs at session start + after each exit gate flush - Bootstrap prompt injected into system prompt when milestones incomplete - /readiness command uses persistent instance - Startup banner shows milestone count - KB_03 updated with bootstrap integration section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bb6f8c2 commit d7c3b72

5 files changed

Lines changed: 42 additions & 9 deletions

File tree

KB/KB_03_cognitive_loop.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ Losers decay 0.9x per cycle. User messages naturally suppress DMN.
3434
- **System prompt:** `gut.gut_summary()` injected alongside corrections
3535
- **Status:** `/status` shows current gut summary
3636

37+
## Bootstrap Readiness Integration (§5.2)
38+
39+
- **Startup:** `bootstrap.check_all()` runs at session start, result shown in banner
40+
- **Each flush:** `check_all()` re-runs after every exit gate flush (periodic milestone re-check)
41+
- **System prompt:** `bootstrap.get_bootstrap_prompt()` injected as `[BOOTSTRAP]` section when milestones incomplete
42+
- **Command:** `/readiness` uses persistent instance (no re-creation)
43+
- When all 10 milestones achieved, bootstrap prompt stops being injected
44+
3745
## Escalation Threshold
3846

3947
Adaptive: 0.3 (bootstrap) -> 0.8 (mature).

src/loop.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from .gate import EntryGate, ExitGate, EntryGateConfig, ExitGateConfig
3030
from .attention import AttentionAllocator, AttentionCandidate
3131
from .gut import GutFeeling
32+
from .bootstrap import BootstrapReadiness
3233
from .context_assembly import assemble_context, render_system_prompt, adaptive_fifo_prune
3334
from .metacognition import composite_confidence
3435
from .safety import SafetyMonitor
@@ -266,6 +267,12 @@ async def cognitive_loop(config, layers, memory, shutdown_event, dmn_queue=None)
266267
)
267268
logger.info("Gut feeling initialized (subconscious centroid seeded from L0/L1)")
268269

270+
# Init bootstrap readiness (§5.2) — 10 milestones
271+
bootstrap = BootstrapReadiness()
272+
await bootstrap.check_all(memory, layers)
273+
achieved, total = bootstrap.progress
274+
logger.info(f"Bootstrap readiness: {achieved}/{total} milestones achieved")
275+
269276
# Conversation history (rolling FIFO)
270277
conversation = []
271278
exchange_count = 0
@@ -282,6 +289,7 @@ async def cognitive_loop(config, layers, memory, shutdown_event, dmn_queue=None)
282289
print(f"Memories: {mem_count}")
283290
print(f"Gates: stochastic entry + ACT-R exit (flush every {EXIT_GATE_FLUSH_INTERVAL} exchanges)")
284291
print(f"Attention: salience-based allocation active")
292+
print(f"Bootstrap: {achieved}/{total} milestones")
285293
print("=" * 60 + "\n")
286294

287295
while not shutdown_event.is_set():
@@ -330,7 +338,7 @@ async def cognitive_loop(config, layers, memory, shutdown_event, dmn_queue=None)
330338
handled = await _handle_command(
331339
user_input, config, layers, memory, model_name,
332340
conversation, exchange_count, entry_gate, exit_gate,
333-
attention, gut=gut,
341+
attention, gut=gut, bootstrap=bootstrap,
334342
)
335343
if handled:
336344
continue
@@ -462,8 +470,11 @@ async def cognitive_loop(config, layers, memory, shutdown_event, dmn_queue=None)
462470
except Exception as e:
463471
logger.debug(f"Correction retrieval failed (non-critical): {e}")
464472

465-
# Append gut feeling + corrections to system prompt
473+
# Append gut feeling + bootstrap + corrections to system prompt
466474
active_system_prompt = system_prompt + "\n\n" + gut.gut_summary()
475+
bootstrap_prompt = bootstrap.get_bootstrap_prompt()
476+
if bootstrap_prompt:
477+
active_system_prompt += "\n\n[BOOTSTRAP]\n" + bootstrap_prompt
467478
if correction_context:
468479
active_system_prompt += "\n\n" + correction_context
469480

@@ -607,6 +618,12 @@ async def _call_retry():
607618
)
608619
exchange_count = 0
609620

621+
# Re-check bootstrap milestones after flush
622+
newly = await bootstrap.check_all(memory, layers)
623+
if newly:
624+
for a in newly:
625+
logger.info(f"Bootstrap milestone unlocked: {a.name}")
626+
610627
logger.info(
611628
f"Cycle: src={winner.source_tag} "
612629
f"salience={winner.salience:.3f} "
@@ -724,7 +741,7 @@ async def _handle_command(
724741
command: str,
725742
config, layers, memory, model_name,
726743
conversation, exchange_count, entry_gate, exit_gate,
727-
attention, gut=None,
744+
attention, gut=None, bootstrap=None,
728745
) -> bool:
729746
"""Handle introspection commands. Returns True if handled."""
730747

@@ -801,10 +818,11 @@ async def _handle_command(
801818
return True
802819

803820
if command == "/readiness":
804-
from .bootstrap import BootstrapReadiness
805-
bootstrap = BootstrapReadiness()
806-
await bootstrap.check_all(memory, layers)
807-
print(f"\n{bootstrap.render_status()}\n")
821+
if bootstrap is not None:
822+
await bootstrap.check_all(memory, layers)
823+
print(f"\n{bootstrap.render_status()}\n")
824+
else:
825+
print("\n[Bootstrap not initialized]\n")
808826
return True
809827

810828
if command.startswith("/docs"):

state/devlog.ndjson

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
{"ts":"2026-02-12T10:00:00Z","type":"milestone","msg":"FW-001 done. Added unattended execution directive to CLAUDE.md + CLEANUP-001 task to roadmap. Starting WIRE phase."}
33
{"ts":"2026-02-12T10:30:00Z","type":"milestone","msg":"WIRE-001 done. GutFeeling wired into loop (startup seed, per-cycle update, attention charge, system prompt injection, /status). relevance.py emotional_alignment accepts gut value directly."}
44
{"ts":"2026-02-12T10:30:00Z","type":"kb_update","msg":"KB_03_cognitive_loop.md updated with gut feeling integration section."}
5+
{"ts":"2026-02-12T11:00:00Z","type":"milestone","msg":"WIRE-002 done. BootstrapReadiness wired into loop: persistent instance, check_all at startup + after flush, bootstrap prompt injected into system prompt, /readiness uses persistent instance."}
6+
{"ts":"2026-02-12T11:00:00Z","type":"kb_update","msg":"KB_03_cognitive_loop.md updated with bootstrap readiness integration section."}

state/handoff.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@
8787
- `gut.gut_summary()` injected into system prompt
8888
- `relevance.py` parameter renamed gut_delta→gut_alignment for direct use
8989
- `/status` shows gut summary
90+
9. WIRE-002 DONE — BootstrapReadiness wired into cognitive loop:
91+
- Persistent `BootstrapReadiness` instance in loop
92+
- `check_all()` at session start + after each exit gate flush
93+
- Bootstrap prompt injected into system prompt when milestones incomplete
94+
- `/readiness` uses persistent instance
9095

9196
---
9297

@@ -102,7 +107,7 @@ Cognitive architecture for emergent AI identity. Three-layer memory unified into
102107
|---------|--------|
103108
| FW-001 | done |
104109
| WIRE-001 | done |
105-
| WIRE-002 | next - Wire BootstrapReadiness into cognitive loop |
110+
| WIRE-002 | done |
106111
| WIRE-003 | next - Wire OutcomeTracker into safety + consolidation |
107112

108113
## What exists

state/roadmap.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"intent": "Check readiness milestones and inject bootstrap prompt when incomplete",
115115
"depends_on": ["PLAN-004"],
116116
"priority": "P1",
117-
"status": "todo",
117+
"status": "done",
118118
"owner": "ai",
119119
"deliverable": "BootstrapReadiness.check_all() called periodically, bootstrap prompt injected when not all milestones achieved, /readiness command functional",
120120
"acceptance_criteria": [

0 commit comments

Comments
 (0)