How limiajayi/agent-harness works
Agent Harness is a terminal coding agent: a user submits a prompt, the selected model may request tools, the harness executes approved tools, and their results return to the model for a response. Built-in tools inspect and modify a workspace; optional MCP servers add GitHub and Exa capabilities through a stdio client. The graph reflects the README workflow and the sampled entry point, agent, provider, and MCP code; several tool implementations and MCP configuration details were not sampled, so their internal links are limited to documented relationships.
Main entry points: index.ts CLI setup · agent.ts Agent loop · provider.ts Provider factory and types · edit_file.ts Edit file
Components 21
Agent orchestration
- CLI setup
src/index.ts - Agent loop
src/agent.ts - Input and workspace config
src/shared.ts
Model providers
- Provider factory and types
src/provider.ts - Ollama model
src/providers/ollama.ts - Gemini model
src/providers/gemini.ts - Claude model
src/providers/claude.ts
Workspace tools
- Read file
src/tools/read_file.ts - List files
src/tools/list_files.ts - Shell command
src/tools/bash_tool.ts - Edit file
src/tools/edit_file.ts - Code search
src/tools/code_search.ts - Workspace path guard
src/tools/paths.ts - Project files
MCP integrations
- Server configuration
src/mcp/config.ts - Server manager
src/mcp/manager.ts - Tool adapter
src/mcp/adapter.ts - Stdio JSON-RPC client
src/mcp/client.ts
Other components
- User
- GitHub MCP server
- Exa MCP server
Connections 36
- User → CLI setup: starts session
README.md - CLI setup → Provider factory and types: creates model
src/index.ts - Provider factory and types → Ollama model: selects provider
src/provider.ts - Provider factory and types → Gemini model: selects provider
src/provider.ts - Provider factory and types → Claude model: selects provider
src/provider.ts - CLI setup → Input and workspace config: creates input reader
src/index.ts - CLI setup → Server configuration: builds server configs
src/index.ts - CLI setup → Server manager: starts servers
src/index.ts - CLI setup → Agent loop: starts agent
src/index.ts - CLI setup → Read file: registers tool
src/index.ts - CLI setup → List files: registers tool
src/index.ts - CLI setup → Shell command: registers tool
src/index.ts - CLI setup → Edit file: registers tool
src/index.ts - CLI setup → Code search: registers tool
src/index.ts - CLI setup → Agent loop: passes MCP tools
README.md - User → Agent loop: provides prompts
src/agent.ts - Agent loop → Provider factory and types: requests completion
src/agent.ts - Agent loop → Read file: executes tool
README.md - Agent loop → List files: executes tool
README.md - Agent loop → Shell command: executes tool
README.md - Agent loop → Edit file: executes tool
src/index.ts - Agent loop → Code search: executes tool
src/index.ts - Read file → Project files: reads files
README.md - List files → Project files: lists files
README.md - Shell command → Project files: runs commands
README.md - Edit file → Workspace path guard: validates paths
src/tools/edit_file.ts - Edit file → Project files: writes files
src/tools/edit_file.ts - Code search → Workspace path guard: validates paths
src/tools/code_search.ts - Code search → Project files: searches files
src/tools/code_search.ts - Server manager → Stdio JSON-RPC client: starts and queries
src/mcp/manager.ts - Server manager → Tool adapter: converts tools
src/mcp/manager.ts - Tool adapter → Stdio JSON-RPC client: calls remote tool
src/mcp/adapter.ts - Stdio JSON-RPC client → GitHub MCP server: stdio JSON-RPC
README.md - Stdio JSON-RPC client → Exa MCP server: stdio JSON-RPC
README.md - Server configuration → GitHub MCP server: configures launch
README.md - Server configuration → Exa MCP server: configures launch
README.md