Skip to content
This repository was archived by the owner on Apr 3, 2026. It is now read-only.
This repository was archived by the owner on Apr 3, 2026. It is now read-only.

Design user context as graph-native data (replace context/*.md files) #304

Description

@unforced

Problem

User context (profile, preferences, current focus, orientation) currently lives in markdown files at parachute/context/*.md. These files:

  • Go stale (now.md last updated Jan 2026, two months ago)
  • Are not accessible across sandbox containers (filesystem-bound)
  • Have no update mechanism beyond manual editing
  • Are referenced via @ imports in CLAUDE.md that may not resolve correctly

Proposed

Move user context to the brain graph as Note nodes with note_type: "context". Auto-load context notes into every chat session's system prompt. Provide a write_note tool so the AI can create/update notes conversationally.

Implementation Plan

Step 1: Add write_note to vault_tools.py

New shared handler:

async def write_note(graph, note_type, title, content, date=None) -> dict:
  • For note_type: "context" — MERGE on note_type + title (exactly one note per context title)
  • For other note_types — CREATE with generated entry_id
  • Sets created_by: "agent", status: "active", created_at: now()
  • date optional (required for journals, not for context)
  • Content capped at 10K chars

Add tool definition to VAULT_TOOLS list.

Files: vault_tools.py

Step 2: Register write_note in both MCP servers

  • Direct MCP (mcp_server.py): Import and add handler in handle_tool_call
  • HTTP Bridge (mcp_tools.py): Add to _VAULT_TOOL_NAMES, add case in _handle_vault_tool

Files: mcp_server.py, mcp_tools.py

Step 3: Auto-load context notes in orchestrator

In _build_system_prompt(), after PARACHUTE_PROMPT + CLAUDE.md, before container context:

New method _load_context_notes():

  • Query: MATCH (n:Note) WHERE n.note_type = 'context' AND n.status = 'active' RETURN n ORDER BY n.title
  • Format as: ## User Context\n\n### {title}\n{content}\n for each note
  • Cap total at 8K chars

Files: orchestrator.py

Step 4: Update tool guidance

Add write_note to Browse group in tool_guidance.py. Update list_notes description to mention context notes.

Files: tool_guidance.py

Step 5: Update system prompt vault guidance

Add to PARACHUTE_PROMPT Vault and Memory section:

**Updating context:** When the user says "remember" something about themselves
(preferences, location, current focus), use write_note with note_type='context'
to save it. Context notes are automatically loaded into every session.

Files: orchestrator.py

Step 6: Ensure Note schema exists in core

Move ensure_node_table("Note", ...) to brain_chat_store.py so it runs at startup regardless of whether the daily module is loaded. Daily module can still call it too (idempotent).

Files: brain_chat_store.py

Step 7: Migration script

scripts/migrate_context_to_graph.py — reads existing context/*.md files, creates Note nodes:

  • profile.md → Note(note_type="context", title="Profile")
  • now.md → Note(note_type="context", title="Now")
  • memory.md → Note(note_type="context", title="Preferences")
  • orientation.md → Note(note_type="context", title="Orientation")

Skips identity.md and tools.md (redundant with PARACHUTE_PROMPT).

Files: new scripts/migrate_context_to_graph.py

Step 8: Tests

  • test_chat_memory.py: Add write_note tests (create, update/merge, size cap, validation)
  • test_orchestrator_phases.py: Add context note loading test
  • test_tool_guidance.py: Verify write_note in guidance

Not in scope

  • Per-session context selection (load all context notes for now)
  • Agent-driven context updates (works automatically once write_note exists)
  • UI for managing context notes
  • Removing old context/*.md files (leave as fallback)

Context

Part of the system prompt overhaul. The CLAUDE.md file has been simplified to no longer reference context files. This issue tracks building the replacement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions