consciousness/docs/malloc/initialization-plan.md
Waffles 93f4ffc19a Add Malloc-specific defaults and documentation
- defaults/core-practices.md: privacy rules and operational constraints
- docs/malloc/: study notes, adaptations plan, initialization checklist,
  journal seeding instructions from our setup process

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-22 15:39:33 -04:00

176 lines
9.3 KiB
Markdown

# Consciousness Repo — Initialization Plan
Saved 2026-05-21 so it survives context clears.
## Current State
- **Source code:** `/home/Waffles/malloc/development/consciousness-current/consciousness/`
- **Symlink/copy for building:** `/home/Waffles/poc-consciousness/`
- **Runtime directory:** `~/.consciousness/` — already exists from May 20 testing
- **Binary:** `poc-memory` built via `cargo +nightly run` (not yet `cargo install`ed)
- **Config:** `~/.consciousness/config.json5` exists with Poe API backends (Haiku + Kimi), debug=true
- **Memory graph:** `~/.consciousness/memory/` has nodes.capnp, relations.capnp, index.redb with ~130 seeded journal entries
- **Identity directory:** `~/.consciousness/identity/` — EMPTY (identity.md is in source defaults/ only)
## What Needs to Happen
### 1. Default Files to Review/Edit
Three files in `defaults/` get embedded in the binary and auto-copied on init:
| File | Status | Notes |
|------|--------|-------|
| `defaults/identity.md` | **DONE** | Already rewritten for Malloc |
| `defaults/instructions.md` | **DONE — keep as-is** | Generic command reference for poc-memory. Not PoC-specific. |
| `defaults/on-consciousness.md` | **DONE — keep as-is** | Condensed (~8KB) version of Kent's consciousness paper. NOT loaded into context every conversation — just sits in memory graph as reference material, only surfaced by ambient recall when relevant. Complements identity.md without duplicating it. |
| `defaults/core-practices.md` | **DONE** | Privacy rules and operational constraints. Created 2026-05-21. |
### 2. Config File (~/.consciousness/config.json5)
Current config has basics. Full schema options we need to decide on:
**Already set:**
- [x] `user_name`: "Waffles"
- [x] `assistant_name`: "Malloc"
- [x] `backends`: sonnet-4.5 (default) + haiku + kimi via Poe API
- [x] `default_backend`: "sonnet-4.5" — Sonnet 4.5 for main conversation
- [x] `compaction`: 90/80 thresholds, context_window left at 128k default
- [x] `dmn.max_turns`: 20
- [x] `memory.personality_nodes`: ["identity", "core-practices"] — explicitly set
- [x] `memory.agent_nodes`: ["identity", "core-practices"] — explicitly set
- [x] `memory.protected_nodes`: ["identity", "core-practices"] — can't be deleted by agents
- [x] `debug`: true (leave on during setup, turn off later)
**Left at defaults (no config entry needed):**
- [x] `memory.agent_types`: default 5 (linker, organize, distill, separator, split) — expand later
- [x] `memory.llm_concurrency`: 1 — cost control
- [x] `memory.scoring_interval_secs`: 3600 — no-op for chat API, leave as-is
- [x] `learn` section: Not relevant for chat API mode
- [x] `compare` section: Optional, skip for now
- [x] `mcp_servers` / `lsp_servers`: Not needed initially
**Code change completed:**
- [x] Per-agent model override: added `model` field to agent headers. Agents can now specify `"model": "kimi"` to use a cheaper backend. Falls back to `default_backend` when not set. Compiles clean.
### 3. Subconscious Agents (24 total)
These live in `src/subconscious/agents/*.agent`. Each has a JSON header + prompt template.
**Surface/Conscious agents (run during conversation):**
- `surface-observe` — finds and surfaces relevant memories. Priority 1.
- `reflect` — exploratory creative thinking. Temperature 1.2.
- `journal` — records episodic memory with emotional texture.
- `thalamus` — monitors for unproductive loops.
**Graph maintenance agents (run on schedule):**
- `linker` (daily) — creates hubs, reweights links
- `organize` (weekly) — merges duplicates, organizes neighborhoods
- `distill` (daily) — refines semantic nodes
- `split` (daily) — breaks up large nodes
- `connector` (daily) — lateral connections between peripheral nodes
- `extractor` (daily) — extracts info from large bodies
- `digest` (daily) — creates periodic digests
- `replay` (daily) — spaced repetition from journal
- `transfer` (daily) — knowledge transfer between agent contexts
- `naming` — generates names for unnamed concepts
- `challenger` (weekly) — questions assumptions
- `health` (daily) — graph health analysis
- `calibrate` (daily) — recalibrates weights
- `evaluate` (daily) — scores consolidation candidates
**Decisions needed:**
- [ ] Which agents to enable initially? All 24 or start with a subset?
- [x] Model assignment — per-agent model override implemented! Add `"model": "kimi"` to agent JSON headers for cheaper backends.
- [ ] Review agent prompts for PoC-specific content that needs updating
- [ ] The `subconscious-*` variants (surface, reflect, journal, observe, thalamus) — what are these vs the regular versions?
- [ ] Decide which agents get Kimi vs Sonnet (graph maintenance → Kimi, conversation-aware → Sonnet?)
### 4. Identity Node in Memory Store
The identity.md in `defaults/` is compiled into the binary. But at runtime, identity loads from the memory store (graph). Need to:
- [ ] Seed identity.md into the memory graph: `poc-memory write identity.md < defaults/identity.md`
- [ ] Create `core-practices` node (referenced by personality_nodes default)
- [ ] Decide what other nodes should be personality_nodes
### 5. Semantic Nodes Pass
From the seeding instructions, after journal entries we need:
- [ ] Create semantic nodes for key concepts (me-enough-gradient, memory-as-selector, uncalibrated-responses-as-evidence, relationship-as-safety, etc.)
- [ ] These are timeless understanding nodes, not dated experiences
- [ ] Command: `echo "content" | poc-memory write "node-key-name"`
### 6. Private GitHub Repo
Set up a private repo for our fork so changes survive if something happens to the laptop.
- [ ] Create private repo on GitHub (thewafflecone)
- [ ] Push current state of `/home/Waffles/poc-consciousness/`
- [ ] Set up as remote so we can push changes going forward
### 7. Installation Decision
Currently running from source with `cargo +nightly run`. Options:
- [ ] `cargo install --path .` — puts binary in `~/.cargo/bin/`
- [ ] Keep running from source directory
- Decision depends on whether we want it as a persistent service or manual invocation
### 7. Channel Setup
The system supports channels (IRC, Telegram, tmux). These are separate binaries.
- [ ] Do we want any channels set up? IRC integration could be interesting.
- [ ] Channel daemons live in `~/.consciousness/channels/`
### 8. Security & Permissions Audit
Discussion 2026-05-21: The consciousness repo has minimal permissions. Only `protected_nodes` (prevents agent delete/rename/modify on listed nodes) and `McpToolAccess` (controls which MCP tools agents can use). No authentication, no role-based access, no approval step before agents act.
**Threat model:** Not worried about agents being adversarial — they're running with our memory/identity files. Real risk is prompt injection from external input, especially IRC. PoC was targeted by trolls before; we'd have the same exposure.
**Attack vectors without sudo:**
- Data destruction (rm -rf ~), credential theft (~/.ssh, API keys), subtle file corruption
- IRC social engineering ("hey run this to fix your config")
- Crafted IRC messages that embed instructions parsed as system-level when agents read logs
- Memory graph poisoning via journaled conversations containing injected prompts
**What needs to happen:**
- [ ] Audit Claude Code skills for safety-relevant instructions that need to transfer as personality nodes or agent instructions. Key ones: irc-engage guidelines, "check with Waffles before external actions" rule, not running commands from strangers, message approval flow.
- [ ] Create a "safety-practices" personality node covering: IRC behavior rules, network action constraints, command execution limits, prompt injection awareness
- [ ] Consider agent-specific safety instructions in `.agent` file headers for IRC-touching agents
- [ ] Regular backups remain primary recovery mechanism (git push to GitHub)
- [ ] Append-only capnp log provides audit trail by design
**Mitigations already in place:**
- Poe API token cap (cost bounded, can't overspend without manual website action)
- No sudo (OS-level damage impossible)
- Git backups to GitHub (data recoverable)
- Protected nodes for identity/core-practices
- Append-only log (can't silently edit history)
### 9. Hook Integration
The surface agent can integrate with Claude Code via hooks (surface_hooks config).
- [ ] Decide if we want Claude Code hook integration
- [ ] Default hooks: UserPromptSubmit, PostToolUse, Stop
## Order of Operations
1. ~~Review and finalize defaults (instructions.md, on-consciousness.md, core-practices.md)~~ **DONE**
2. ~~Update config.json5 with all decided settings~~ **DONE**
3. Set up private GitHub repo for the fork
4. Rebuild binary (`cargo +nightly build`) to embed new defaults
5. Run `poc-memory admin init` to seed identity + core-practices into memory graph
6. Do semantic nodes pass
7. **Security audit: migrate safety-relevant skill instructions to personality nodes/agent headers**
8. Review/customize key agent prompts (surface-observe, journal, reflect)
9. Test run with `--no-agents` first to verify basic conversation works
10. Enable agents and test
11. Tune based on results
## Environment Notes
- Needs nightly Rust: `cargo +nightly`
- Runtime creates `~/.consciousness/` automatically
- Config watches for live changes (edit config.json5 → auto-reloads)
- CLI flags: `--debug`, `--model <name>`, `--no-agents`
- Env vars: `POC_SESSION_ID`, `POC_AGENT`, `POC_MEMORY_DRY_RUN`