zypher-agent
CLAUDE.md331 starsChanged 12 months agoApache-2.0View on GitHub
Root workspace commands (run from repo root): Zypher Agent is a TypeScript SDK for building production-ready AI agents. Published as @zypher/agent on JSR. - ZypherAgent.ts: Main agent class with reactive task execution loop. Uses RxJS Observable to stream TaskEvents. Manages message history, checkpoints, and coordinates with McpServerManager and LoopInterceptorManager. - factory.ts: createZypherAgent() - simplified factory that creates context, registers tools, and connects MCP servers in one call. - llm/: Model provider abstraction (ModelProvider interface) with implementations for Anthropic and OpenAI.…
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 67
Use createTool() helper to define custom tools
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
Root workspace commands (run from repo root):
- Run CLI:
deno task cli- Runs the CLI from packages/cli - Test all:
deno task test- Runs all tests with leak tracing - Test watch:
deno task test:watch- Runs tests in watch mode - Check all:
deno task checkall- Runs format, lint, and type check
Code quality
- Type check:
deno check . - Lint:
deno lint - Format:
deno fmt
Architecture Overview
Zypher Agent is a TypeScript SDK for building production-ready AI agents.
Published as @zypher/agent on JSR.
Monorepo Structure
packages/
├── agent/ # Core SDK (@zypher/agent)
│ ├── src/ # Source code
│ └── tests/ # Tests
├── cli/ # CLI tool (@zypher/cli)
examples/
└── ptc/ # Programmatic Tool Calling exampleCore Components (packages/agent/src/)
- ZypherAgent.ts: Main agent class with reactive task execution loop. Uses RxJS Observable to stream TaskEvents. Manages message history, checkpoints, and coordinates with McpServerManager and LoopInterceptorManager.
- factory.ts:
createZypherAgent()- simplified factory that creates context, registers tools, and connects MCP servers in one call. - llm/: Model provider abstraction (
ModelProviderinterface) with implementations for Anthropic and OpenAI. Handles streaming chat completions and token usage tracking. - loopInterceptors/: Chain of responsibility pattern for post-inference
processing. Each interceptor can return
LoopDecision.CONTINUEto continue the agent loop orLoopDecision.COMPLETEto finish.ToolExecutionInterceptor: Executes tool calls from LLM responsesMaxTokensInterceptor: Auto-continues when response hits token limitErrorDetectionInterceptor: Detects errors and prompts for fixes
- mcp/: Model Context Protocol integration
McpServerManager: Manages MCP server lifecycle, tool registration, and tool execution with optional approval handlersMcpClient: Individual server connection with status observable- Supports CoreSpeed MCP Store registry for server discovery
- tools/: Extensible tool system using Zod schemas
fs/: File system tools (ReadFile, ListDir, EditFile, GrepSearch, etc.)codeExecutor/: Programmatic Tool Calling (PTC) viaexecute_codetool- Use
createTool()helper to define custom tools
- CheckpointManager.ts: Git-based workspace state snapshots. Creates a separate git repository in workspaceDataDir to track file changes without affecting the user's main repository.
- TaskEvents.ts: Discriminated union of all events emitted during task execution (text streaming, tool use, messages, usage, completion).
Key Patterns
- Event streaming:
agent.runTask()returnsObservable<TaskEvent>for real-time updates - Tool approval: Optional
ToolApprovalHandlercallback before tool execution - Context separation:
ZypherContext(workspace/directories) vsZypherAgentConfig(behavioral settings) - MCP Server sources: Registry (CoreSpeed MCP Store) or direct configuration
Testing
Tests are in packages/agent/tests/. Integration tests require environment
variables (API keys, S3 credentials). Run a single test:
deno test -A packages/agent/tests/McpServerManager.test.tsDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

