agentleFS
corespeed-iocorespeed-io/zypher-agent/CLAUDE.md

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
  1. Very specific:

    Use createTool() helper to define custom tools

    line 67

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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 example

Core 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 (ModelProvider interface) 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.CONTINUE to continue the agent loop or LoopDecision.COMPLETE to finish.
    • ToolExecutionInterceptor: Executes tool calls from LLM responses
    • MaxTokensInterceptor: Auto-continues when response hits token limit
    • ErrorDetectionInterceptor: Detects errors and prompts for fixes
  • mcp/: Model Context Protocol integration
    • McpServerManager: Manages MCP server lifecycle, tool registration, and tool execution with optional approval handlers
    • McpClient: 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) via execute_code tool
    • 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() returns Observable<TaskEvent> for real-time updates
  • Tool approval: Optional ToolApprovalHandler callback before tool execution
  • Context separation: ZypherContext (workspace/directories) vs ZypherAgentConfig (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.ts

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.