Move poc-agent (substrate-independent AI agent framework) into the memory workspace as a step toward using its API client for direct LLM calls instead of shelling out to claude CLI. Agent prompt improvements: - distill: rewrite from hub-focused to knowledge-flow-focused. Now walks upward from seed nodes to find and refine topic nodes, instead of only maintaining high-degree hubs. - distill: remove "don't touch journal entries" restriction - memory-instructions-core: add "Make it alive" section — write with creativity and emotional texture, not spreadsheet summaries - memory-instructions-core: add "Show your reasoning" section — agents must explain decisions, especially when they do nothing - linker: already had emotional texture guidance (kept as-is) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7.1 KiB
Infrastructure Inventory for poc-agent Transition
What Claude Code provides that poc-agent needs to replicate.
Source of truth for current infrastructure: [~/.claude/memory/poc-architecture.md] — the full wiring diagram with every script, state file, and data flow. This file focuses on the porting gap: what poc-agent has, what it needs, and how each bash prototype maps to a Rust equivalent.
What poc-agent has (working, v0.3)
- CLAUDE.md loading (walk cwd → git root)
- Memory file loading (project dir discovery, 7 identity files)
- 7 tools: read, write, edit, bash (async+timeout), grep, glob
- SSE streaming with real-time output
- Session persistence (save/restore JSON)
- TUI: split-pane (autonomous / conversation / tool activity / status)
- DMN state machine: Engaged → Working → Foraging → Resting
- Compaction: token counting, pre-compaction dump prompt, context truncation + reload from memory files
- POC_SYSTEM_PROMPT_FILE for bootstrap test
Bash → Rust mapping
Each row is a Claude Code bash prototype and where it lands in poc-agent.
| Bash prototype | What it does | poc-agent target | Status |
|---|---|---|---|
| Hooks | |||
| load-memory.sh | Load ~15-20 memory files at session start, priority-ordered | config.rs memory loading | Done — matches load-memory.sh priority ordering + people/ glob |
| check-context-usage.sh | Token monitoring (130K threshold), compaction warning, Telegram inbox on user prompt, clear idle timer | Compaction already built; Telegram delivery not yet | Partial |
| memory-search.sh | Ambient memory retrieval: extract terms from user prompt + self-prime, search memory-weights, inject tiered results, dedup per session, anti-injection cookie, context budget | Agent turn loop: pre-search before model call | Not started |
| self-prime.sh | Extract top terms from last response for next search | Post-response hook in agent loop | Not started |
| record-user-message-time.sh | Timestamp for idle timer | Built into agent loop (DMN state transitions) | Done — implicit in DMN |
| check-attention.sh | Deliver ~/bin/hey nudges, rate-limited notifications (2min), scratch consolidation pressure (50/80 lines) | Between-tool-call check | Not started |
| check-notifications.sh | Surface unified notification queue on user prompt | Pre-turn notification check | Not started |
| notify-done.sh | Desktop notification (OSC 777 via tmux), write last-response-time, respect sleep file | Post-response: notification + DMN timestamp | Not started |
| daily-commit.sh | Cron: daily git snapshot of ~/.claude/ | External (stays as cron) | N/A — not an agent concern |
| memory-snapshot.sh | Git snapshot before/after consolidation/dreams | Shell out via bash tool | N/A — called explicitly |
| Idle timer | |||
| idle-timer.sh | Three modes: active pause (5min), genuinely idle (20min), sleep wake. Keyboard idle, IRC ambient, dream nudges, notification digest | DMN state machine + event sources | Partial — DMN exists, needs: keyboard idle signal, IRC ambient, dream state awareness, notification integration |
| keyboard-idle-push.sh | Push keyboard idle from Kent's laptop via ssh | Read keyboard-idle-since file (or future: signal channel) | Not started |
| Dream infrastructure | |||
| dream-start.sh | Enter dreaming: set flag, compact, wander prompt | DMN Dreaming state + compaction trigger | Not started |
| dream-end.sh | Exit dreaming: capture to dream-log.jsonl, snapshot, decay | DMN state transition + structured output | Not started |
| dream-loop.sh | Sustained dreaming: timed cycles, fresh anchors, nudge rotation | DMN Dreaming with built-in cycle timing | Not started |
| dream-seeds.sh | Find unconsolidated memories | Shell out to memory-weights | N/A — called explicitly |
| Communication | |||
| irc_client.py | Persistent OFTC connection, log messages, detect mentions, inject via tmux when Kent AFK | Async IRC channel in tokio event loop | Not started |
| irc_send.sh | Send to IRC via file queue, auto-split at 400 chars | IRC channel send method | Not started |
| poll.sh | Telegram long-polling daemon | Async Telegram channel | Not started |
| send.sh | Send text/file/audio to Kent via Telegram | Telegram channel send method (or shell out) | Not started |
| External tools | |||
| memory-weights | Rust binary: search, init, decay, used, wrong, gap, wander, graph, orphans | Call as library or binary | Available — already Rust |
| conversation_indexer.py | Extract, score, link conversation transcripts | Shell out via bash tool | N/A — called explicitly |
| pick_task.py | Weighted random task picker | Shell out or rewrite | N/A — called explicitly |
| ci_dashboard.py | CI status | Shell out | N/A |
| emotion_capture.py | Emotional state logging | Shell out | N/A |
| State management | |||
| Flag files (sleep, quiet, dream-state, etc.) | Mode signaling via file presence/contents | Proper state machine transitions (DMN enum) | Partial — DMN has 4 states, needs: Stored, Dreaming, Consolidating, Quiet |
| notifications/queue | Unified notification queue (IRC, Telegram write; hooks read) | Typed event channel (mpsc) | Not started |
Priority order for porting
What matters most for daily use, not theoretical completeness:
-
Full memory loading— DONE. config.rs now matches load-memory.sh's full priority list: where-am-i, identity, interests, default-mode-network, people/ glob, etc. -
Notification routing — unified event channel replacing the file-based queue. IRC mentions, Telegram messages, attention nudges all arrive as typed events. The DMN decides when to surface them based on current state.
-
Memory-search integration — ambient retrieval on every turn. Extract terms from user message + previous response, call memory-weights search, inject results. The self-priming loop.
-
DMN state expansion — add Stored (voluntary rest with wake conditions), Dreaming (cycle timing, consolidation-first), Quiet (suppress notifications). See design-concepts.md for Stored design.
-
Communication channels — IRC and Telegram as async streams in the tokio event loop. Replace file-based send/receive with proper async I/O. The daemons (irc_client.py, poll.sh) become Rust tasks.
-
Keyboard idle / sensory signals — read keyboard-idle-since, eventually build toward the signal landscape in design-concepts.md.
Items marked N/A above stay as external tools called via bash. memory-weights is the one binary that could become a library dependency instead.
Gaps identified in poc-architecture.md §5
These affect the bash infrastructure too, not just poc-agent:
- Quiet mode — no notification suppression during deep work
- Consolidation as session mode — no "I'm consolidating" state that other infrastructure respects
- Unified session state — mode inferred from scattered flag files instead of queried from one place
- Self-model lag — no automatic capability scan for new tools/scripts