Spaces:
Sleeping
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Guidelines
Pipeline-First Development (MANDATORY)
All new functionality MUST be implemented as pipeline Steps composed via the Pipeline engine. Do NOT write standalone scripts, ad-hoc loops, or inline logic that bypasses the pipeline. Before writing any code:
- Read
docs/design/PIPELINE_DESIGN.mdto understand the Step β Pipeline β Branch model. - Implement logic as a
Stepclass withrequires/providesdeclarations and a__call__(self, ctx) -> ctxmethod. - Compose steps using
Pipeline().then(...)and.branch(...)β never manual for-loops or direct function chaining. - Use
StepContext.replace()for immutable context updates β never mutate context directly. - Put integration-specific data in
metadata, not new context fields, unless the field is shared across multiple pipelines.
Anti-patterns to reject:
- Writing a function that calls multiple steps manually instead of composing them in a Pipeline
- Inline reflection/evaluation logic instead of creating a ReflectStep or EvaluateStep
- Ad-hoc
ThreadPoolExecutorusage instead ofasync_boundaryandmax_workerson steps - Standalone scripts that duplicate pipeline functionality without using the pipeline engine
- Bypassing
requires/providescontracts by accessing context fields not declared inrequires
If a task seems like it cannot fit the pipeline model, explain why to the user before proceeding β do not silently circumvent it.
Core Code Protection
Do NOT modify core modules (ace/core/, pipeline/) without explicit user approval. Before proposing any change to these directories:
- Read the relevant design docs (
docs/design/ACE_ARCHITECTURE.md,docs/design/PIPELINE_DESIGN.md) thoroughly. - Evaluate whether the change is truly required or if it can be achieved outside the core (e.g., in an integration, step, or example).
- Clearly explain the proposed change and its justification to the user before making any edits.
- Wait for the user to explicitly accept before proceeding.
Documentation Maintenance
Before working on code in ace/, read docs/design/ACE_ARCHITECTURE.md to understand the current architecture.
Before working on code in pipeline/ or ace/core/, read docs/design/PIPELINE_DESIGN.md to understand the pipeline engine.
Docs MUST be kept in sync with code. Any change that alters a public API, renames a concept, adds/removes a module, or changes execution flow requires a corresponding update to the relevant docs. Do not merge code changes that make the documentation inaccurate.
Key design docs:
docs/design/ACE_ARCHITECTURE.mdβ ACE architecture: layers, core concepts, roles, steps, runners, integrationsdocs/design/ACE_REFERENCE.mdβ ACE code reference: full implementations, API signatures, usage examplesdocs/design/ACE_DECISIONS.mdβ design decisions and rejected alternatives (ACE, pipeline, migration)docs/design/PIPELINE_DESIGN.mdβ pipeline engine: steps, StepProtocol, Pipeline, Branch, concurrency- If you need to work with collected traces from Logfire, read
agent-guides/logfire.md
Project Structure
ace/β core library: roles (PydanticAI-backed), skillbook, steps, runners, providers, RR, integrations, observabilitypipeline/β generic pipeline engine thataceis built on (seedocs/design/PIPELINE_DESIGN.md)ace-eval/β evaluation framework (submodule, separate repo)tests/β unit/integration tests (pytest)examples/β runnable demos grouped by integrationagent-guides/β internal development guides for LLM agents; not part of the public docs sitedocs/β guides and reference materialdocs/design/ACE_ARCHITECTURE.mdβ architecture and concepts (keep in sync with code)docs/design/ACE_REFERENCE.mdβ code reference and examples (keep in sync with code)docs/design/ACE_DECISIONS.mdβ design decisions and rejected alternativesdocs/design/PIPELINE_DESIGN.mdβ pipeline engine design doc (keep in sync with code)
Commands
uv syncβ install all dependenciesuv run pytestβ run tests (excludesintegrationandrequires_apimarkers by default)uv run pytest -m unit/-m integration/-m slowβ run by markeruv run black ace/ tests/ examples/β format codeuv run mypy ace/β type check
Coding Style
- PEP 8 with Black formatting (line length 88)
- Type hints and docstrings for public APIs
- Python 3.12 target
- Test files:
tests/test_*.py; functions:test_*; classes:Test*
Testing
- Pytest is the primary runner
- Add tests for new features; include regression tests for bug fixes
Commits
- Conventional Commits:
feat(scope): subject,fix(scope): subject - Do NOT add
Co-Authored-Bytrailers to commit messages - PRs should include description, test results, and relevant docs updates
ACE Roles (quick reference)
| Role | Responsibility | Key Class |
|---|---|---|
| Agent | Executes tasks using skillbook strategies | Agent |
| Reflector | Analyzes execution results | Reflector |
| SkillManager | Updates the skillbook with new strategies | SkillManager |
Integration Runners
| Runner | Framework | Use Case |
|---|---|---|
ACELiteLLM |
LiteLLM (100+ providers) | Simple self-improving agent |
ACELangChain |
LangChain | Wrap chains/agents with learning |
ACEBrowserUse |
browser-use | Browser automation with learning |
ACEClaudeCode |
Claude Code CLI | Coding tasks with learning |
NEVER USE FALLBACKS OR IMPLEMENT THINGS I NEVER ASKED FOR.
Keep your answers concise and to the point. If you don't know something, say you don't know instead of making assumptions or fabricating information. Always ask clarifying questions if the user's request is ambiguous or lacks necessary details.