Context
How RA-H assembles the system prompt that shapes every conversation
One-liner: RA-H builds a 6-section system prompt with 4 cache breakpoints. Hub nodes (your 5 most-connected nodes) are always included as a user model. Guides provide on-demand reference material the agent can read via tools.
How It Works
When you chat with RA-H, the AI doesn't start from scratch. It automatically receives:
- Base context - Understanding of nodes, edges, dimensions, and tools
- Hub nodes - Your 5 most-connected knowledge hubs
- Guides index - Available reference documents the agent can read
- Focused node - Whatever you're currently looking at
- Preferences guide - User-editable guide for persistent context (replaces old memory system)
System Prompt Architecture
Every conversation includes a system prompt assembled by the context builder. The prompt follows a fixed 6-section structure optimized for Anthropic prompt caching:
| # | Section | Contents | Cache BP | Tokens |
|---|---|---|---|---|
| 1 | Identity | Who RA-H is, behavioral rules | BP1 | ~200 |
| 2 | Structure | Minimal schema reference | BP1 | ~100 |
| 3 | Instructions | Formatting, citing, extraction rules | BP1 | ~150 |
| 4 | Guides | Frontmatter index of available guides | BP2 | ~120 |
| 5 | Hub Nodes | Top 5 most-connected nodes | BP3 | ~200 |
| 6 | Current Focus | Focused nodes + active dimension + highlighted passage | BP4 | varies |
Cache breakpoints (BP): Sections 1-3 share BP1 (most stable). Guides index is BP2. Hub nodes are BP3. Current focus is BP4 (most volatile, changes every message).
Tool definitions are NOT in the system prompt — they go through the API tools parameter. This follows OpenAI's finding of ~2% accuracy improvement.
Hub Nodes
Hub nodes are your 5 most-connected nodes by edge count. They are always included in every conversation — there is no toggle. They serve as the agent's model of who you are and what you care about.
What It Does
Hub nodes provide your top 5 most-connected nodes as background awareness to every conversation. These are your knowledge hubs—nodes with the most edge connections to other content.
Why Connections Matter
Nodes with many edges are typically:
- Core concepts that relate to many things
- Active projects you've linked extensively
- Important frameworks that inform your thinking
- Key people or resources referenced across your work
By using edge count, RA-H automatically surfaces what's actually important in your graph without you having to curate anything.
What Agents See
=== HUB NODES ===
Your 5 most-connected nodes. This is their ontology — use it.
[NODE:1573:"building ra-h"] (47 edges) — Knowledge management system with graph-based...
[NODE:4436:"Continual learning"] (32 edges) — Research on how neural networks can learn...
...
Agents see just the ID, title, and description—enough to know what's important. If they need more detail, they use queryNodes or getNodesById to retrieve full node details.
Guides System
Guides are markdown reference documents the agent can read on demand via the readGuide tool. They replace the old approach of cramming everything into the system prompt.
System Guides (Immutable)
5 built-in guides that are always available and cannot be edited or deleted:
| Guide | Contents |
|---|---|
schema | Full database schema — tables, columns, types, common queries |
creating-nodes | When/how to create nodes, link rules, synthesis patterns |
edges | Edge philosophy, explanation rules, direction convention |
dimensions | Create/update/delete/lock, naming conventions |
extract | Pre-check workflow, extraction tools, after-extraction steps |
User Guides (Editable)
Users can create up to 10 custom guides for domain-specific reference material. The agent can also create guides via the writeGuide tool.
A preferences guide ships by default as the replacement for the old agent memory system — it stores user preferences, working patterns, and communication style.
Guide Index
The system prompt includes a frontmatter index listing all available guides (not their content). The agent reads full guide content on demand:
Available guides (use readGuide to access):
★ schema — Full database schema reference
★ creating-nodes — When and how to create nodes
★ edges — Edge philosophy and rules
★ dimensions — Dimension operations and conventions
★ extract — Extraction workflow and tools
preferences — User preferences and patterns
★ = immutable system guide
Current Focus
The final section includes whatever the user is actively working with:
- Focused nodes: Open in the Focus panel (description only, not full notes)
- Active dimension: Currently selected dimension filter
- Highlighted passage: Text the user has selected/highlighted
This section is the most volatile and uses the last cache breakpoint (BP4).
Context Flow
┌─────────────────────────────────────────────────┐
│ Your Message │
└──────────────────────┬──────────────────────────┘
▼
┌─────────────────────────────────────────────────┐
│ Context Assembly │
│ ┌─────────────┐ ┌─────────────┐ ┌──────────┐ │
│ │Base Context │ │Hub Nodes │ │ Focused │ │
│ │(how RA-H │ │(top 5 by │ │ Node │ │
│ │ works) │ │edge count) │ │ │ │
│ └─────────────┘ └─────────────┘ └──────────┘ │
│ ┌─────────────┐ ┌──────────────┐ │
│ │Guides Index │ │Preferences │ │
│ │(available) │ │Guide │ │
│ └─────────────┘ └──────────────┘ │
└──────────────────────┬──────────────────────────┘
▼
┌─────────────────────────────────────────────────┐
│ AI Agent │
│ Has context + can use tools for more detail │
└─────────────────────────────────────────────────┘
Growing Your Context Automatically
The beauty of hub nodes is that as you use RA-H, your context naturally improves:
- Create nodes about important concepts
- Create edges connecting related ideas
- The most-connected nodes automatically surface as context
There's nothing to configure or maintain. The nodes that matter most naturally rise to the top.
Privacy
Everything is local. Context assembly happens entirely on your machine. Your nodes, edges, guides, and conversation history never leave your device unless you explicitly share them.