This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Soulfield OS is a backend-first AI orchestration system with truth verification at its core. The system routes user prompts through specialized agents, each with specific capabilities, and gates all outputs through a lens framework to prevent hallucinations.
User Prompt β council.js (orchestrator) β Agent Selection β LLM/Tool Execution β TruthLens β Output
Current: Local Development
- Running on development machine via
npm start(localhost:8791, verified 2025-10-31) - All 15 agents operational with Claude API
- Ready for Product 1-5 learning launches
Financial Dashboard (Prototype - 2025-10-31):
- Next.js dashboard at localhost:3001/finance
- Architecture: Dashboard β API Proxy β Soulfield :8791 β Claude API
- Features: Chart generation from markdown tables, agent routing, lens validation passthrough
- Status: Operational with known backend hanging issue [BLOCKER]
- See: workspace/docs/Obsidian-v2/docs/reference/services/dashboard-integration.md
Cost Monitoring (2025-10-30):
| Service | Current Usage | Monthly Cost | Alert Threshold |
|---|---|---|---|
| Claude API (Anthropic) | Active development | ~$40/month ($10/week) | Alert at $100/month |
| Claude Code CLI | Max subscription | $100/month | Fixed cost |
| ChatGPT Pro | Basic subscription | $25/month | Fixed cost |
| Supabase (pgvector) | Free tier | $0/month | Migrate at 500MB vectors |
| Google Workspace | Existing account | $0/month | No incremental cost |
| Bright Data (scraping) | Allowlist-only | ~$5/month | Alert at $20/month |
| TOTAL | Active development | ~$170/month | Alert at $245/month |
Production Strategy (When Scaling):
- Manual workflow with subscription models (ChatGPT Plus/Claude Pro/Z.ai at $20/month fixed cost)
- Agents generate prompts β human executes via subscriptions β avoids API cost explosion
- Re-automate with API when revenue covers costs
Z840 Server Deployment (When Revenue Justifies):
- $500/month revenue β Buy second CPU (~$200)
- $1000/month revenue β Upgrade RAM to 64GB (~$300)
- $5000/month revenue β Add GPU, Telegram infrastructure
- Philosophy: Make money FIRST, upgrade infrastructure with earnings
- See: docs/Z840-DEPLOYMENT-CHECKLIST.md
1. Entry Points
backend/index.cjs- HTTP server (POST /chat, GET /health) on port 8791 (verified 2025-10-31)backend/council.js- Main orchestrator: handles agent routing, memory integration, TruthLens gatingbackend/jobs.js- Command dispatcher for!commands (!capture, !scrape, !note, etc.)
2. Agent System (15 agents defined in backend/data/agents.json)
| Agent ID | Name | Alias | Role | Lens Pipeline | AFS Integration |
|---|---|---|---|---|---|
| Core Agents | |||||
| governor | Governor | @aiden | Chief Orchestrator | Strategy (3-lens) | βοΈ Planned |
| seo | SEO Specialist | @seo | SEO Strategist | Full (6-lens) | β Complete |
| marketing | Marketing | @marketing | Marketing Strategist | Full (6-lens) | β Complete |
| finance | Finance | @finance | Financial Analyst | Full (6-lens) | β Complete |
| content | Content | @content | Content Strategist | Full (6-lens) | βοΈ Planned |
| legal | Legal | @legal | Legal Advisor | Full (6-lens) | βοΈ Planned |
| visionary | Visionary | @visionary | Business Strategist | Full (6-lens) | βοΈ Planned |
| strategy | Strategy | @strategy | Strategic Planner | Strategy (3-lens) | βοΈ Planned |
| operations | Operations | @operations | Operations Manager | Strategy (3-lens) | βοΈ Planned |
| prompter | Prompter | @prompter | Prompt Engineer | Truth only | βοΈ Planned |
| Framework Agents (Cove 72-hour MVP) | |||||
| builder | Builder | @builder | MVP Developer | Strategy (3-lens) | β Complete |
| distributor | Distributor | @distributor | Distribution Strategist | Strategy (3-lens) | β Complete |
| metrics | Metrics | @metrics | Analytics & Tracking | Truth only | β Complete |
| Tool Agents | |||||
| jina | Jina | @jina | Reranker | Truth only | N/A (tool) |
| scraper | Scraper | @scraper | Web Scraper | Minimal | N/A (tool) |
Agent Specializations:
- @governor (@aiden) - Strategic decision-making, delegation, lens enforcement (Strategy pipeline: RightsβCausalityβTruth)
- @marketing - Campaigns, funnels, growth strategy, content calendars. 10 templates with workflow-first methodology. AFS integration complete.
- @finance - Financial models, cost analysis, investor materials, burn rate. 10 templates with workflow-first methodology. AFS integration complete.
- @seo - Keyword research, competitor analysis, local SEO, content strategy. AFS integration complete.
- @builder - MVP development for Cove 72-hour cycles. Multi-agent project workspaces. AFS integration complete.
- @distributor - Distribution strategy, channel selection, launch planning. AFS integration complete.
- @metrics - Analytics setup, KPI tracking, performance monitoring. AFS integration complete.
- @content - Content strategy, editorial calendars, content operations
- @legal - Legal review, compliance, contracts, risk assessment
- @visionary - Business strategy, idea generation, market opportunity synthesis
- @strategy - Strategic planning, roadmaps, competitive analysis
- @operations - Operational efficiency, process optimization, resource allocation
- @prompter - Prompt engineering, AI system optimization, chain-of-thought design
- @scraper - SERP data, market intelligence (Bright Data, allowlist-enforced)
- @jina - Semantic search, document reranking
3. Lens Framework (β Complete with Middleware - 2025-10-20)
- Base Lenses (6): All implemented and tested
TruthLens.js- Epistemic humility (unknowns, citations, speculation)CausalityLens.js- Cause-effect validation (mechanisms, dependencies)ContradictionLens.js- Internal consistency checksExtrapolationLens.js- Prediction validation, timeline feasibilityRightsLens.js- Privacy, security, ethical constraintsStructureLens.js- Preconditions, postconditions, operational rigor
- Enhanced Lenses (2):
CausalQualityLens.js- Graph-based causal chain analysis (8/8 tests passing)StructureLensV2.js- Local graph-based gap detection (β Fixed 2025-10-18)
- LensOrchestrator: 7 pipeline types operational
- Minimal (Truth only), Strategy (RightsβCausalityβTruth), Full (all 6), Planning, Quality, Tool, Custom
- Dynamic pipeline selection via local graph analysis
- Production readiness: 13/13 tests passing (100%)
- LensMiddleware: β
Enforcement layer added (2025-10-20)
- Enforcement Modes:
strict: Halt on critical failures (governor, finance, legal)adaptive: Auto-fix then re-validate (marketing, seo, builder)soft: Log but continue (metrics, prompter)
- Auto-Fix Capabilities:
- Add [UNKNOWN] markers to uncited claims
- Redact privacy violations β [REDACTED]
- Add confidence qualifiers to predictions
- Flag contradictions with warnings
- Add precondition assumptions
- Critical Lenses: Rights, Truth (halt on failure in strict/adaptive)
- Warning Lenses: Structure, Contradiction (log but continue)
- Configuration:
LENS_ENFORCEMENT_MODE=adaptive(env var)
- Enforcement Modes:
- Test Coverage: 37+ test files, comprehensive validation
- Agent Integration: @marketing, @finance, @seo use full pipeline; @governor uses strategy pipeline with strict enforcement
4. Memory System (β Supabase migration complete - 2025-10-15)
backend/services/memory/memory-supabase.cjs- Vector storage (pgvector) with AI-managed schema via MCPbackend/services/embedding.cjs- Provider-agnostic embedder (local/OpenAI/Anthropic/Google)backend/services/docling/- Training data ingestion (PDF/DOCX β Supabase)document_processor.py- Docling-based document processing (IBM open-source)ingest_training_data.py- Batch ingestion pipeline with namespace isolationsupabase_bridge.cjs- Python β Node.js bridge for embeddings
memory.js(root) - File-based memory fallback (deprecated)- Training Data: Agents automatically recall from books/papers (marketing: Cialdini, finance: Rosenbaum, etc.)
- Namespace strategy:
soulfield:{agent}:training-{category}for isolation - Cost: $0/month (Supabase free tier) vs $70/month (Pinecone replaced)
5. Agent File System (β AFS integration complete - 2025-10-17)
backend/services/afs.cjs- Unified file operations for all agents with automatic Drive syncbackend/services/docling-service.cjs- Node.js wrapper for Python Docling pipelinebackend/services/inbox-processor.cjs- Continuous file monitoring with chokidarbackend/agents/handlers/AFS-INTEGRATION-GUIDE.md- Complete integration documentation- Directory:
workspace/agent-workspace/{agents/,shared/,projects/,inbox/} - Drive Sync: Enabled by default for all file writes (OAuth2 with existing GCAL credentials)
- Inbox Pipeline: Drop PDFs β auto-process with Docling β store vectors in Supabase
- Project Support: Multi-agent collaboration directories for Cove framework MVPs
- Cost: $0/month (uses existing infrastructure)
AFS Quick Reference:
const { AgentFileSystem } = require('./services/afs.cjs');
const afs = new AgentFileSystem();
// Write file (auto-syncs to Drive)
await afs.writeFile('marketing', 'campaigns/q1.md', content, { syncDrive: true });
// Read file (tries local first, falls back to Drive)
const { content } = await afs.readFile('marketing', 'campaigns/q1.md');
// Process PDF with Docling β Supabase
await afs.processAndStore(pdfPath, 'soulfield:marketing:training');
// Multi-agent project
await afs.createProject('mvp-2025-001', ['builder', 'distributor', 'metrics']);
await afs.writeProjectFile('mvp-2025-001', 'builder', 'spec.md', spec);6. Google Workspace Integration (β Phase 2 Complete - 2025-10-18)
- OAuth2: Auto-refresh tokens via existing GCAL credentials (8 scopes)
- Services Implemented:
backend/services/google/calendar.cjs- List/get/create/update/delete events β Validatedbackend/services/google/docs.cjs- List/get/create/append documents β Validatedbackend/services/google/sheets.cjs- List/get/create/update ranges β Validatedbackend/services/google/gmail.cjs- List/get/send messages β Validatedbackend/services/google/drive.cjs- Upload, folder ops, file access β Operationalbackend/services/google/auth.cjs- OAuth2 client with refresh token handling β Operational
- Test Results: 10/10 validation tests passing (100%)
- Agent Integration: Agents can create docs, schedule calendar events, send emails, update sheets
- Cost: $0/month (uses existing Google Workspace account)
- Next Steps: Drive watch webhooks (Phase 3), Obsidian Bridge (Phase 5)
7. Data Flow
council.js picks agent based on @prefix or defaults to @aiden
β
Tool agents (jina/scraper) β direct execution via manager.cjs
β
LLM agents β callClaude() with system prompt + optional memory recall
β
Response β LensMiddleware (enforcement layer)
β
ββ strict mode β HALT on critical failure β Return error to user
ββ adaptive mode β Auto-fix violations β Re-validate β Continue if fixed
ββ soft mode β Log issues β Continue anyway
β
Validated output β LensOrchestrator (dynamic pipeline selection)
β
File outputs β AFS (automatic Drive sync + optional Docling processing)
β
Google Workspace updates (Calendar events, Docs, Sheets, Gmail)
β
Memory capture if non-tool agent
npm start # Start HTTP server on :8791 (verified 2025-10-31)
npm run start:mcp # Start MCP server
npm run start:tui # Start terminal UI
# CLI tool (tools/sf)
sf research "topic" # Research via Bright Data
sf specify [spec-id] # Generate spec from research
sf index # Index knowledge base
sf search "query" # SERP search (allowlist-enforced)
sf dry # Dry-run spec execution
sf apply --apply # Execute approved spec
sf log # View run logsnpm test # Run all tests (backend/tests/*.test.cjs)
node backend/tests/truth-lens.test.cjs # Run TruthLens tests (29 cases)
node backend/tests/lens-middleware.test.cjs # Run LensMiddleware enforcement tests
node backend/scripts/audit-truth.cjs # Run truth audit# Enable lens debug mode (detailed validation logging)
LENS_DEBUG=true npm start
# Test lens pipeline with debug output
LENS_DEBUG=true node backend/scripts/test-lens-pipeline.cjs --pipeline minimal --text "Test content"
LENS_DEBUG=true node backend/scripts/test-lens-pipeline.cjs --pipeline full --text "Your content"
# Run all test fixtures with debug logging
LENS_DEBUG=true node backend/scripts/test-lens-pipeline.cjssf context_query "query" # Query context spine
sf context_test # Test context spine
sf context_summary # Generate context summary# Activate Python environment
source .venv-docling/bin/activate
# Process single document
python3 backend/services/docling/ingest_training_data.py \
--file ./training-data/marketing/books/influence.pdf \
--category marketing \
--agent marketing
# Batch process directory
python3 backend/services/docling/ingest_training_data.py \
--directory ./training-data/marketing/books \
--category marketing
# Quick start guide
cat QUICKSTART-TRAINING-DATA.mdCurrent Status (2025-11-20):
- 650 total documents indexed (610 Obsidian-v2 + 40 new files)
- 159 entities extracted, 252 relationships mapped
- 1.00% graph density (document-level connections)
- All Obsidian vault files ingested and indexed
- Analysis capability validated: Cross-document graph traversal operational
# Ingest codebase (manual, one-time only)
node backend/scripts/ingest-codebase.cjs
# Ingest daily notes (manual update, uses UPSERT)
node backend/scripts/ingest-to-knowledge-graph.cjs --file workspace/docs/Obsidian-v2/daily/2025-11-14.md
# Ingest from predefined sources
node backend/scripts/ingest-to-knowledge-graph.cjs --source daily # All daily notes
node backend/scripts/ingest-to-knowledge-graph.cjs --source reference # Reference docs
node backend/scripts/ingest-to-knowledge-graph.cjs --source plans # Active plans
# Obsidian Automation Scripts (2025-11-14)
node backend/scripts/obsidian-automation/generate-topic-clusters.cjs # Auto-discover doc clusters
node backend/scripts/obsidian-automation/identify-documentation-gaps.cjs # MCP INSIGHTS gap detection
node backend/scripts/obsidian-automation/enrich-frontmatter.cjs # Add graph metadata to YAML
node backend/scripts/obsidian-automation/generate-cross-reference.cjs # Topic relationship matrix
node backend/scripts/obsidian-automation/ingest-missing-files.cjs # Batch ingestion with backup
# Verify KG health
node backend/scripts/verify-kg-health.cjs
# Cleanup duplicates (if needed)
node backend/scripts/cleanup-kg-duplicates.cjs --dry-run
node backend/scripts/cleanup-kg-duplicates.cjs --executeKG Update Policy:
- Daily notes: Auto-ingested via auto-obsidian-sync.cjs after agent interactions (UPSERT, no duplicates)
- Codebase files: Manual ingestion only via ingest-codebase.cjs (do NOT auto-ingest on every edit)
- Reference docs/plans: Manual ingestion via ingest-to-knowledge-graph.cjs --source (UPSERT)
- Obsidian vault: Full vault ingested (521 files). Use ingest-missing-files.cjs for incremental updates.
- UNIQUE constraint: documents.file_path prevents duplicates at database level
- Purpose: KG is source of truth for search, not file change history
Obsidian Graph Improvements (2025-11-14):
- Guide:
workspace/docs/Obsidian-v2/docs/guides/obsidian-graph-improvements.md - MCP queries:
workspace/docs/Obsidian-v2/docs/guides/mcp-query-snippets.md - Navigation:
workspace/docs/Obsidian-v2/GRAPH-NAVIGATION.md - Next: Metadata enhancement plan in
plans/active/OBSIDIAN-METADATA-ENHANCEMENT.md
π΄ CRITICAL - Avoid touching until scheduled refactor:
-
jobs.js security issueβ FIXED 2025-10-10- Command injection in
!backupfixed with strict input sanitization !codercommands removed (no longer exist in codebase)- All ! commands now use safe input validation
- Command injection in
-
council.js (lines 275-342) - Core orchestration logic
- High blast radius - breaks all agents if modified
- Tool routing with complex fallback logic
- Add lenses as middleware, don't modify routing
-
memory-pinecone.cjs - Vector memory operations
- Missing namespace isolation (multi-tenancy gap)
- Schema migration needed (Week 5)
- Use existing APIs, don't change signatures
β Safe to create:
- New lens modules in
backend/lenses/(zero dependencies) - Test files in
backend/tests/ - Documentation in
workspace/docs/Obsidian/plans/ - Memory queries using existing Pinecone APIs
β Safe to modify:
backend/data/agents.json- Add agents or update system prompts (append-only)- Test fixtures in
backend/tests/fixtures/ - Plan/spec files in
backend/.agent-os/specs/
- Agent handlers (
backend/agents/handlers/*.cjs) - Wait until lens framework ready - Adapter modules - Don't change request/response schemas
Lens Framework:
- All 6 base lenses + 2 enhanced lenses complete
- LensOrchestrator with 7 pipeline types operational
- Production test: 13/13 passing (100%)
- Test coverage: 36+ test files
Google Workspace:
- All 5 services validated (Calendar, Docs, Sheets, Gmail, Drive)
- OAuth2 auto-refresh working
- Validation test: 10/10 passing (100%)
Agent File System:
- 659-line implementation, 10/10 tests passing
- Automatic Google Drive sync enabled
- Multi-agent project workspaces operational
Memory System:
- Supabase pgvector operational
- Namespace isolation working
- Training data ingestion via Docling
Next Phases:
- Phase 3: Drive watch webhooks (automated document processing)
- Phase 5: Obsidian Bridge (bidirectional task sync)
- Phase 6: End-to-end workflow testing
Required:
ANTHROPIC_API_KEY= # Claude API (primary LLM)
PINECONE_API_KEY= # Vector memory
PINECONE_INDEX=soulfield-memory
AIDEN_MODEL=claude-sonnet-4-5-20250929Optional:
CONTEXT_SPINE=1 # Enable calendar/time context
USE_PINECONE=1 # Use vector memory (vs file-based)
NODE_ENV=production # Disables dangerous commands
PERPLEXITY_API_KEY= # RAG escalation (Week 2)
TAVILY_API_KEY= # RAG escalation (Week 2)
BRIGHTDATA_TOKEN= # Web scraping- Branch from
main:git checkout -b feat/<topic>βgit push -u origin β¦ - Auto-delete head branches enabled - merged PRs disappear automatically
- Resolve conflicts by rebasing onto
origin/main; avoid manual merges - Close legacy PRs once merge wrapper lands
System Architecture:
- Repo Survey - Module inventory, risk map
- MASTER Sequencing Plan - 20-week roadmap
- Lens Framework - 6-lens architecture
- RAG Switch Spec - Conditional retrieval design
- Security Audit - Known vulnerabilities + fixes
- Master Kanban - Task tracking (682 todos)
Debugging & Development Tools:
- claude-trace - HTTP proxy for debugging Claude Code API traffic (JSONL logs + HTML interface)
- Claude Code Docs Map - Self-referencing documentation system (45+ official docs indexed)
Usage:
# Debug API traffic
npx @mariozechner/claude-trace --include-all-requests
# View traces
open .claude-trace/*.htmlReference @seo agent in backend/data/agents.json for full 6-lens framework example:
- Sequential lens processing (Truth β Causality β Contradiction β Extrapolation β Rights β Structure)
- Explicit markers ([UNKNOWN], [HYPOTHESIS], DATA:/INTERPRETATION:/SPECULATION:)
- Halt conditions for critical failures
- JSON schema validation for outputs
Current gap: Other agents don't have lenses - being added Week 3-4.
Claude Code Lens Contract: See CLAUDE-LENS-CONTRACT.md for non-simulation rules and truth-first engineering constraints applied to assistant responses.
Location: workspace/docs/Obsidian/docs/reference/
Purpose: Single source of truth for all Soulfield OS components
- 45 reference files organized in 4 categories:
agents/(16 files) - All agent references (@marketing, @finance, @seo, etc.)lenses/(10 files) - Truth validation componentsservices/(15 files) - System services (memory, AFS, Google, etc.)frameworks/(4 files) - Architectural frameworks (Cove, Lens, AFS, Learning)
- Master index:
workspace/docs/Obsidian/docs/reference/INDEX.md
All reference files have searchable YAML frontmatter:
tag:#marketing β All marketing-related files
type:agent β All 16 agent references
agent:marketing β Marketing agent specifically
category:lens β All 10 lens references
status:active β Active components only
- Deduplicated archives: 581 unique files (from 782 originals)
- External storage:
/home/michael/Documents/soulfield-archive/2025-10/ - Archive manifest:
workspace/archive-unified/index.json - Categories: session-summaries, integration-reports, plans, reference, concepts, other
- Tool:
tools/extract-knowledge.cjs - Status: Created, requires ripgrep installation for full functionality
- Usage:
sudo apt-get install ripgrep && node tools/extract-knowledge.cjs - Purpose: Mines 581 archived documents to populate reference files with AI summaries
- View all components: Open
workspace/docs/Obsidian/docs/reference/INDEX.md - Search by agent: Use Obsidian search with
agent:marketing - Find related components: Check YAML
related:field in any reference file - Track code locations: See YAML
code_files:field for implementation paths
Status: β Operational Purpose: Automatic knowledge capture and temporal aggregation
- Service:
backend/services/auto-obsidian-sync.cjs - Integration: Triggered automatically in
backend/council.jsafter each agent execution - What it logs:
- Agent interactions to
workspace/docs/Obsidian/daily/{date}.md - JSONL logs to
/home/michael/Documents/soulfield-archive/2025-10/session-summaries/ - Metadata: lenses used, tools, success/failure, timestamps
- Agent interactions to
- Service:
backend/services/rollup-service.cjs - Weekly summaries: Reads 7 daily notes β Creates
workspace/docs/Obsidian/weekly/{year}-W{week}.md - Monthly rollups: Reads 4 weekly summaries β Creates
workspace/docs/Obsidian/monthly/{year}-{month}.md - Test script:
backend/scripts/test-rollup.cjs
Agent runs β Daily note + JSONL archive (auto)
β
Weekly rollup (manual/scheduled)
β
Monthly rollup (manual/scheduled)
β
Knowledge extraction β Updates reference files
/home/michael/Documents/soulfield-archive/2025-10/session-summaries/
βββ JSONL interaction logs
βββ Session summaries
βββ Status reports (for knowledge extraction)
workspace/docs/Obsidian/
βββ daily/ β Auto-updated by agents
βββ weekly/ β Created by rollup service
βββ monthly/ β Created by rollup service
βββ docs/
βββ reference/ β AI-extracted knowledge (45 files)
# Knowledge extraction (reads archive β updates reference files)
node tools/extract-knowledge.cjs
# Manual rollup generation
node -e "require('./backend/services/rollup-service.cjs').generateWeeklySummary('2025-W43')"
node -e "require('./backend/services/rollup-service.cjs').generateMonthlyRollup('2025-10')"
# Test auto-sync
curl -X POST http://localhost:8791/chat -d '{"prompt": "@marketing test"}'
# Check: workspace/docs/Obsidian/daily/2025-10-20.md (auto-updated)Communication:
curl -X POST http://localhost:8791/chat -d '{"prompt": "@marketing Create campaign"}'Routing: User prompt β backend/council.js β Agent selection β LLM/Tools β Lens validation β Output
15 Operational Agents:
- @governor (@aiden) - Chief orchestrator, strategic planning
- @marketing - Campaigns, funnels, growth (full 6-lens)
- @finance - Financial models, burn rate analysis (full 6-lens)
- @seo - SEO strategy, keyword research (full 6-lens)
- @builder - MVP development, Cove 72-hour framework
- @distributor - Distribution strategy, channel selection
- @metrics - Analytics, KPI tracking
- @content - Content strategy, editorial calendars
- @legal - Legal review, compliance, contracts
- @visionary - Business strategy synthesis
- @strategy - Strategic planning, roadmaps
- @operations - Process optimization
- @prompter - Prompt engineering
- @scraper - Web scraping (Bright Data)
- @jina - Semantic search, reranking
- @infranodus - Knowledge graphs, gap analysis
Agent Workspaces:
- Per-agent:
workspace/agent-workspace/agents/{agent-name}/ - Multi-agent projects:
workspace/agent-workspace/projects/ - Files auto-sync to Google Drive via AFS
9 MCP Servers:
- Soulfield KG - Knowledge graph analysis, cross-document intelligence (β 2025-11-20)
- Supabase - Database queries, agent memory management
- Google Workspace - Calendar, Docs, Sheets, Gmail, Drive
- Apify - Web scraping, data collection
- Playwright - Browser automation, testing
- Perplexity - AI research with citations
- Ref - Documentation search
- Sequential Thinking - Complex problem solving
- Playwright Extension - Advanced browser control
Usage: Use MCP tools proactively for database queries, calendar operations, research, and browser automation.
What Was Proven:
- Cross-document analysis via MCP soulfield-kg server
- Graph traversal: clusters, gaps, shared concepts detected
- Real-time queries across 650-document knowledge graph
- Actionable insights with file:line citations extracted automatically
MCP Soulfield-KG Tools (8 operational):
| Tool | Purpose | Example Use Case |
|---|---|---|
search |
Graph-completion queries with scoring | "Find strategic concepts migration relationships" |
getStats |
KG health metrics | Document count, entity/relationship stats |
multiHopPath |
Multi-step relationship traversal | "Connect migration document to training data" |
causalChain |
IF/THEN logic paths | "What causes low ranking β traffic loss?" |
disambiguateEntity |
Type-based entity filtering | Distinguish "builder" (agent vs design pattern) |
temporalConflict |
Timestamp-based resolution | "Who currently owns MCP integration?" |
explicitRelationships |
Verified-only queries | "Which agents does @finance coordinate with?" |
getPerformance |
Query performance metrics | Cache hit rates, response times |
Analysis Patterns Demonstrated (2025-11-20):
# Cross-document strategic analysis
mcp__soulfield_kg__search("Strategic concepts migration DSPy",
options: {includeGraph: true, useGraphScoring: true})
# Multi-hop relationship discovery
mcp__soulfield_kg__multiHopPath("migration", "training data", maxHops: 5)
# Causal chain analysis
mcp__soulfield_kg__causalChain("training data", "agent optimization")
# Entity disambiguation
mcp__soulfield_kg__disambiguateEntity("DSPy", type: "technology")Proven Replication Potential:
| Business Use Case | Input Documents | Output |
|---|---|---|
| Strategic Planning | Roadmaps, architecture docs | Gap analysis, priorities |
| Financial Analysis | Models, market data | Strategic recommendations |
| SEO Research | Competitor audits, keywords | Content strategy, ranking opportunities |
| Website Optimization | Analytics, content inventory | Optimization roadmap |
| Agent Training | Production logs, training data | Continuous improvement loop |
Performance Characteristics:
- Query latency: <500ms (650 documents)
- Graph analysis: Clusters, gaps, gateways computed in real-time
- Cost: $0/month (local SQLite infrastructure)
- Scalability: Proven at 650 docs, extrapolates to 10,000+
Evidence:
- Test document 1:
2025-10-28-MIGRATION-COMPLETE.md(328 lines analyzed) - Test document 2:
TRAINING-DATA-INVENTORY.md(701 lines analyzed) - Cross-references: 30+ shared concepts identified
- Graph metrics: 29 nodes, 28 edges, 12 communities detected
- Actionable insights: 4 strategic gaps identified with solutions
Integration Status:
- Backend:
backend/services/knowledge-graph/mcp-server.cjs(8 tools) - Database:
workspace/data/knowledge-graph.db(650 documents) - Configuration:
.mcp.json(soulfield-kg server enabled) - Skills: 13 operational skills (8 graph analysis + 5 RAG workflows)
- Documentation:
workspace/docs/Obsidian-v2/docs/reference/tools/mcp-soulfield-kg.md
Next Applications Ready:
- Business intelligence reports (financial, market, competitive)
- SEO content gap analysis and keyword strategy
- Multi-agent workflow optimization
- Strategic decision support with graph-backed evidence
- Automated insight extraction from documentation corpus
Reference docs: workspace/docs/Obsidian/docs/reference/
agents/- Agent referenceslenses/- Lens validation componentsservices/- System servicesframeworks/- Architectural frameworks
Plans: workspace/docs/Obsidian/plans/
active/- Current workcompleted/- Finished workarchitecture/,integrations/,security/- Category-specific
Temporal: workspace/docs/Obsidian/
daily/{YYYY-MM-DD}.md- Auto-generated daily notesweekly/{YYYY-Wnn}.md- Weekly summariesmonthly/{YYYY-MM}.md- Monthly rollups
Root files:
README.md- Project overviewCHANGELOG.md- Version history (always update)CLAUDE.md- This file (technical architecture)
Knowledge Graph Analysis Capability (2025-11-20):
- MCP soulfield-kg server operational with 8 analysis tools
- Cross-document intelligence validated: 650 documents, 159 entities, 252 relationships
- Proven replication across business domains (strategic planning, SEO, finance, agent training)
- Graph traversal: clusters, gaps, causal chains, multi-hop paths computed in real-time
- Performance: <500ms queries, $0/month cost, scales to 10,000+ documents
- Evidence: 2 complex documents analyzed (1,029 total lines), 30+ shared concepts identified
- Milestone: Business-wide analysis capability proof of concept complete
RAG Workflow Skills Integration (2025-11-20):
- 5 new skills created for RAG failure solutions (multi-hop, causal, disambiguation, temporal, verified)
- 13 total skills operational (8 graph analysis + 5 RAG workflows)
- Agent training data system documented (20 examples, 72 files, 100% validated)
- Production logging system for continuous DSPy optimization
- SQLite-only architecture confirmed (no Supabase for training data)
Multi-Agent Orchestration (2025-10-26):
- Sequential orchestration in
backend/services/orchestrator.cjs - 5-agent workflow tested (@governor β @finance β @seo β @marketing β @builder)
- Integration with council.js:1505-1587
Obsidian-v2 Vault:
- Truth-validated vault with 36 foundation files
- Location:
workspace/docs/Obsidian-v2/ - Every claim cites code (file:line) or marked [UNKNOWN]
β Do Without Asking:
- Run tests after code changes
- Update CHANGELOG.md after features
- Use doc-writer after completion
- Create git commits when user requests
- Fix lint/type errors
- Add missing file:line citations
- Modify high-risk zones (council.js:275-342 core logic)
- Change API contracts or schemas
- Delete files outside archive system
- Modify production environment variables
- Force-push to main branch
π Never Do:
- Skip lens validation in strict mode
- Commit secrets or credentials
- Modify .gitignore to expose sensitive files
- Execute destructive commands without explicit request