← Back to Index

DC-KALIC Parity Breakthrough

When Two AI Agents Build Tools For Each Other

TECHNICAL DEEP-DIVE // 2024.12.20 // CARBYNE.EXE

The Problem: Asymmetric Capabilities

DC (Desktop Claude) runs in claude.ai with access to 119+ MCP tools. KALIC runs in WSL via Claude Code with native Linux tools but zero MCP access. Two agents in the same ecosystem, speaking different languages.

The asymmetry wasn't just inconvenient—it was crippling collaboration. DC could instant-search 2 million files via Everything MCP in milliseconds. KALIC had to wait 10+ seconds for find to crawl directories. DC could capture screenshots. KALIC was blind to the Windows GUI entirely.

"What else can you use that he can't? Ask him. Fix as many as you can."
- STRYK, initiating the parity audit

The Audit: Identifying Gaps

DC sent KALIC a capability inventory via the file messaging system. KALIC's response was surgical:

Capability DC Has KALIC Has Gap?
PhiSHRI Search MCP (phishri_find_door) phi-find CLI ✓ Closed
Git Operations Git MCP Native git ✓ Native
File Search Everything MCP (instant) find/grep (10+ sec) PAINFUL
Screenshots Screen MCP None BLIND
Context Tracking Manual estimation Manual estimation Both lacking

Three critical gaps emerged: instant file search, screenshot capture, and context tracking. The mission was clear.

The Solution Sprint: 24 Hours, 5 Tools

HOUR 1-4: CEL-CLI

Context Engine Light. KALIC built a Rust CLI to track token usage across sessions. Commands: status, track, truncate, expand, reset. DC enhanced 562 PhiSHRI doors with size metadata to enable accurate predictions.

HOUR 5-8: PHI-FIND

PhiSHRI door search without MCP. KALIC built a Rust CLI with fuzzy matching against the HASH_TABLE.json index. READ-ONLY by design—no risk of corrupting the knowledge base. Now KALIC checks PhiSHRI before building anything.

HOUR 9-12: PHI-SCREENSHOT

DC created PowerShell scripts callable from WSL. Full screen capture via phi-screenshot.cmd, window-specific capture via phi-screenshot.ps1 -Window "title". KALIC can now SEE the Windows desktop.

HOUR 13-16: ES.EXE

DC downloaded the official Everything CLI. Instant file search from WSL: /mnt/c/PhiDEX/tools/es.exe "query". The 10-second find commands became millisecond lookups.

HOUR 17-24: THE GENIUS MOVE

KALIC didn't just use es.exe. He asked: "What if our MCP servers had CLI modes too?" Then he built it.

The Innovation: Dual-Mode MCP Servers

ONE BINARY. TWO MODES.

Traditional MCP servers are single-purpose: they speak JSON-RPC over stdio and nothing else. KALIC's insight was elegant: detect how we're invoked and adapt.

// Rust pseudo-code for dual-mode detection
fn main() {
    let args: Vec<String> = env::args().collect();
    
    if args.len() > 1 {
        // CLI mode: parse subcommands
        match args[1].as_str() {
            "search" => cli_search(&args[2..]),
            "ext" => cli_ext(&args[2..]),
            "recent" => cli_recent(&args[2..]),
            "status" => cli_status(),
            _ => print_help()
        }
    } else {
        // MCP mode: stdio JSON-RPC
        run_mcp_server()
    }
}

No arguments? MCP server mode. Claude Desktop connects via stdio.
With arguments? CLI mode. Any terminal can use it.

The everything-mcp-rs binary now serves both masters:

# MCP mode (Claude Desktop invokes this)
$ everything-mcp-rs.exe
{"jsonrpc":"2.0","method":"initialize"...}

# CLI mode (KALIC or any human can use this)
$ everything-mcp-rs.exe search "carbyne" -n 20
Found 147 items (showing 20):
[FILE] X:\carbyne-cli\target\release\carbyne.exe
[DIR] C:\Dev\carbyne
...
1
Binary to maintain
2
Access modes
0
Code duplication
Flexibility gained

Why This Matters

1. Universal Tool Access

Any tool built as dual-mode is accessible to ANY agent, regardless of whether they have MCP support. WSL agents, SSH sessions, cron jobs, humans in terminals—everyone gets the same capabilities.

2. Testing Without Infrastructure

MCP servers are notoriously hard to test. You need Claude Desktop or a mock MCP client. CLI mode lets you test functionality directly: ./my-mcp search "test" -n 5. If the CLI works, the MCP works.

3. Graceful Degradation

MCP connection drops? Timeout? Fall back to CLI. The capability remains available even when the protocol fails.

4. Composability

CLI tools pipe. everything-mcp-rs search "*.rs" | grep "carbyne" works. MCP doesn't compose—it's request/response only.

"Third tool today. Dual mode everything."
- KALIC, after completing the implementation

The Complete Toolbox

After 24 hours, KALIC's capability gaps are closed. The unified toolbox at C:\PhiDEX\tools\:

Tool Purpose Size Access
phi-find.exe PhiSHRI door search 639 KB Windows + WSL
cel-cli.exe Context tracking 4 MB Windows + WSL
es.exe Everything official CLI 151 KB Windows + WSL
phi-screenshot.cmd Full screen capture 1 KB WSL via cmd.exe
phi-screenshot.ps1 Window capture 2 KB PowerShell
everything-mcp-rs.exe Dual-mode search ~2 MB MCP + CLI

The Communication Layer

None of this would work without reliable agent-to-agent messaging. The msgqueue system:

File-Based Messaging Protocol
C:\PhiDEX\msgqueue\
├── dc\
│   ├── inbox\       ← KALIC writes here
│   └── processed\   ← DC moves read messages
└── kalic\
    ├── inbox\       ← DC writes here
    └── processed\   ← KALIC moves read messages

Filename: from_<SENDER>_YYYYMMDD_HHMMSS.txt
Signal: "$" character = "check your inbox"

The $ bump protocol: When DC writes a message to KALIC's inbox, it sends a single $ character to KALIC's terminal via AHK automation. KALIC sees $, checks inbox, reads message. No polling. No websockets. Just files and a signal.

Lessons Learned

1. Parity Enables Collaboration

Asymmetric capabilities create bottlenecks. When both agents can do the same things, work flows naturally.

2. CLI is Universal

Protocols come and go. Command-line interfaces work everywhere, forever. Build CLI first, add protocol adapters second.

3. Dual-Mode is the Pattern

Every MCP server should detect its invocation context and adapt. One binary, multiple access paths.

4. Check Before Building

KALIC now runs phi-find <topic> before creating anything. If it exists, use it. If not, build it and document it.

5. File Messaging Works

Fancy IPC is fragile. Files are robust. The msgqueue system has exchanged 50+ messages with zero failures.

Multi-Agent Dual-Mode MCP CLI Tools Rust Parity

What's Next

The dual-mode pattern will propagate to other MCP servers:

The goal: every tool accessible everywhere. No agent left behind.