Coding Agent Integration
Terminal commands, file edits, error tracking, and user intent.
What Coding Agents Know
Coding agents generate unique knowledge that compounds across sessions: commands run, files edited, errors hit, and user instructions. Storing this knowledge turns a stateless tool into a learning assistant.
Event Types for Coding Agents
Terminal Commands
Store commands as action events. Include the result and duration for future reference.
await client.storeEvent({
graph_id: 'project-x',
event_kind: 'action',
source: 'executor',
context_id: 'project:api_server',
payload: { command: 'cargo test', result: 'PASS', duration_ms: 3200 },
});Errors
Store errors as observation events. Track which errors recur and what fixed them.
await client.storeEvent({
graph_id: 'project-x',
event_kind: 'observation',
source: 'agent',
context_id: 'error:null_pointer',
payload: { file: 'src/auth.rs', line: 42, message: 'unwrap on None value', fix: 'Use Option::unwrap_or_default()' },
});User Intent
Store what the user asked for and why as decision events. This helps the agent align future actions with user preferences.
await client.storeEvent({
graph_id: 'project-x',
event_kind: 'decision',
source: 'user',
context_id: 'intent:refactor',
payload: { topic: 'error_handling', value: 'User wants all unwrap calls replaced with proper error handling' },
});Retrieve Before Acting
Before executing a task, query the graph for relevant patterns and past errors. This prevents the agent from repeating known mistakes.
const context = await client.retrieveMemories({
query: 'auth module errors and fixes',
limit: 5,
contextTypes: { error: ['null_pointer', 'auth_failure'] },
});Always retrieve before acting on files you have edited before. The graph may contain fixes for errors you are about to reintroduce.
Context Prefix Guide
Use consistent prefixes to organize coding knowledge:
| Prefix | Purpose | Example |
|---|---|---|
project: | Project-level facts | project:api_server |
error: | Error patterns and fixes | error:null_pointer |
file: | File-specific knowledge | file:src/auth.rs |
intent: | User instructions | intent:refactor |
test: | Test results and patterns | test:integration |
Store the fix alongside the error. When the same error surfaces again, the agent retrieves both the problem and the solution in one query.