This file provides guidance to coding agents working in this repository.
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
ReflectSteporEvaluateStep - 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.
Do NOT modify core modules (ace/, 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 (for example, 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.
Before working on code in ace/, read docs/design/ACE_ARCHITECTURE.md to understand the current architecture.
Before working on code in pipeline/, read docs/design/PIPELINE_DESIGN.md to understand the pipeline engine.
Before working on code in ace/rr/, read docs/design/RR_DESIGN.md to understand the recursive reflection design.
Before working on code in ace/cli/, read docs/design/CLI_DESIGN.md to understand the CLI architecture.
Docs MUST be kept in sync with code. Any change that alters a public API, renames a concept, adds or 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- core ACE architecture: roles, runners, skillbook, adaptation loops, integrations, and public APIdocs/design/PIPELINE_DESIGN.md- pipeline engine: steps,StepProtocol,Pipeline, branching, execution, andSubRunnerdocs/design/RR_DESIGN.md- recursive reflection design inace/rr/docs/design/CLI_DESIGN.md- CLI architecture, lazy imports, and command designdocs/design/ACE_REFERENCE.md- code reference and examplesdocs/design/ACE_DECISIONS.md- design decisions and rejected alternatives- If you need to work with collected traces from Logfire, read
agent-guides/logfire.md
ace/- main package: core data types, role implementations, steps, runners, integrations, providers, recursive reflection, and observabilitypipeline/- generic pipeline engine used by ACEace-eval/- evaluation framework submodule / separate repo workspacetests/- pytest-based test suite, including pipeline engine and RR coverageexamples/- runnable demos for ACE, integrations, and pipeline compositionbenchmarks/- benchmark loaders and task definitionsscripts/- helper scripts and research toolingagent-guides/- internal development guides for LLM agents; not part of the public docs sitedocs/- guides and reference materialdocs/getting-started/- installation, setup, and quick startdocs/concepts/- core concepts such as roles, skillbook, updates, and insight levelsdocs/guides/- in-depth guides for full pipelines, composition, prompts, integration, and testingdocs/integrations/- per-integration docs for LiteLLM, browser-use, LangChain, Claude Code, Claude SDK, MCP, OpenClaw, hosted API, and Opikdocs/pipeline/- pipeline engine guides and API referencedocs/api/- package API indexdocs/design/- architecture references (ACE_ARCHITECTURE, ACE_REFERENCE, ACE_DECISIONS, PIPELINE_DESIGN, RR_DESIGN, CLI_DESIGN)
uv sync- install dependenciesuv run pytest- run tests with coverage onaceandpipeline(--cov-fail-under=25)uv run pytest -m unit- run unit testsuv run pytest -m integration- run integration testsuv run pytest -m slow- run slow testsuv run pytest -m requires_api- run tests that need live API credentialsuv run black ace/ pipeline/ tests/ examples/- format codeuv run mypy ace/- type check the main package
- 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*
- Pytest is the primary runner
- Some tests use
unittest-style classes but still run under pytest - Use the existing markers:
unit,integration,slow, andrequires_api - Add tests for new features and regression tests for bug fixes
- Conventional Commits:
feat(scope): subject,fix(scope): subject - PRs should include description, test results, and relevant docs updates
| Role | Responsibility | Key Class |
|---|---|---|
| Agent | Executes tasks using skillbook strategies | Agent |
| Reflector | Analyzes execution results | Reflector |
| SkillManager | Updates the skillbook with new strategies | SkillManager |
| Runner | Framework | Use Case |
|---|---|---|
ACELiteLLM |
LiteLLM | Batteries-included self-improving agent with .ask(), .learn(), and trace learning helpers |
ACE |
Core ACE runner | Full learning loop over Sample + TaskEnvironment |
TraceAnalyser |
Offline traces | Learn from recorded traces without re-running tasks |
BrowserUse |
browser-use | Browser automation with learning |
LangChain |
LangChain | Wrap chains, agents, or graphs with learning |
ClaudeCode |
Claude Code CLI | Coding tasks with learning |
The Anthropic SDK integration lives in ace/integrations/claude_sdk.py and is step-based rather than a public runner class.