Skip to content

Multi-Agent Workflows ​

Cortexa is the shared memory layer between all your AI agents. Thoughts captured by one agent are available to every other agent via MCP.

The Problem ​

Most developers use multiple AI tools:

  • Claude Code for backend Rust/Python
  • Cursor for frontend React/TypeScript
  • Codex for quick one-shot tasks
  • Gemini for research and exploration

Each has its own context, its own memory, its own conversation history. A decision made in Claude Code is invisible to Cursor. A debug finding from Codex doesn't surface in Gemini.

The Solution ​

All agents connect to the same Cortexa vault via MCP:

Claude Code ──┐
Cursor ───────┤── MCP ──▶ Cortexa Vault ◀── MCP ──┤── Codex
Gemini ───────┘                                     └── Custom agent

Every cortexa_capture from any agent writes to the same encrypted store. Every cortexa_context or cortexa_search reads from the same index.

Example Flow ​

Morning: Architecture session in Claude Code ​

You: "Let's redesign the auth middleware"
Claude Code: *captures decision via cortexa_capture*
  → thought_type: "architecture"
  → project: "my-api"
  → agent: "claude-code"

Afternoon: Frontend work in Cursor ​

You: "Build the login page"
Cursor: *calls cortexa_context("login authentication frontend")*
  → Returns: "Architecture decision from this morning: auth middleware
    uses JWT with RS256, tokens refresh via /auth/refresh endpoint"
Cursor: "I see from your vault that the backend uses JWT with RS256.
  I'll implement the frontend token refresh to match."

Evening: Quick fix in Codex ​

You: "Fix the token refresh bug"
Codex: *calls cortexa_context("token refresh bug")*
  → Returns: architecture decision + frontend implementation notes
Codex: "Based on your prior decisions and the frontend implementation,
  the bug is likely in the refresh interval timing..."

Session Grouping ​

Use session_id to group related captures:

json
{
  "content": "Decided to use WebSocket for real-time updates",
  "thought_type": "decision",
  "session_id": "2026-05-21-auth-redesign",
  "agent": "claude-code"
}

Later, review everything from that session:

json
{ "name": "cortexa_recent", "arguments": { "session_id": "2026-05-21-auth-redesign" } }

Cross-Project Discovery ​

The vault is project-agnostic. A pattern from Project A surfaces when you hit the same problem in Project B:

cortexa_context({
  context: "rate limiting implementation",
  project: "project-b"
})

Returns:

## Patterns
- [72%] Token bucket rate limiter with Redis backend (project-a)
  → Settled on 100 req/min per user, 1000 req/min per API key

## Debug Findings  
- [65%] Rate limiter race condition under concurrent requests (project-a)
  → Fixed with Redis MULTI/EXEC atomic increment

Project B gets the benefit of Project A's experience.

Continuous Capture (Not Just End-of-Session) ​

The highest-value pattern is capturing as you work, not just summarizing at the end:

After this eventCapture with thought_type
Bug fixeddebug — root cause + fix
Feature builtdecision — what + why + trade-offs
Architecture choicearchitecture — decision + alternatives
Something discovereddiscovery — what + implications
Pattern establishedpattern — when to use it

Why this matters: End-of-session summaries lose detail. A bug fix captured immediately preserves the root cause analysis. The reflection engine analyzes these granular captures to surface cross-cutting patterns, contradictions, and knowledge gaps automatically.

Configure this in your CLAUDE.md:

markdown
### Continuous Capture (REQUIRED)
After each bug fix, feature, or decision, call `cortexa_capture` immediately.

Cognition Tools for Agents ​

Beyond capture and search, agents can query the collective cognition layer:

ToolWhat agents learn
cortexa_confidence_historyHow confident is this prior decision? Is it stale?
cortexa_peer_profilesWhich team members have expertise in this area?
cortexa_learned_proceduresWhat tool sequence works best for this thought type?
cortexa_tool_metricsWhich tools are slow or error-prone?
cortexa_reflectionTrigger a meta-analysis of recent work

Example: an agent working on auth can call cortexa_confidence_history on a prior auth decision to check if it's still reliable, or cortexa_peer_profiles to see which peer has the most auth-related shares.

Best Practices ​

  1. Capture as you work, not just at the end — granular captures are more valuable than summaries
  2. Use thought types — decision vs debug vs architecture helps agents and reflection prioritize
  3. Include project and file context — enables project-specific boosting
  4. Use session IDs — groups related captures for easy review
  5. Run sync-context regularly — keeps the .cortexa-context.md file fresh for agents that don't call MCP tools
  6. Enable reflection — the background analysis finds patterns you wouldn't see manually
  7. Enable confidence scoring — stale knowledge gets flagged, high-confidence items rank higher in search

Hive: Cross-Device, Cross-Team ​

For multi-device or team workflows, connect to a Hive relay server:

  • Thoughts shared by one device appear on all connected devices
  • Auto-import brings peer thoughts into your local vault
  • Cross-user thesis synthesis combines perspectives automatically
  • Peer profiles track expertise and trust across the team
  • Each team member's agent benefits from everyone's captured knowledge

Built with Rust, Tauri, and a lot of captured thoughts.