Python work happens in autocontext/:
cd autocontext
uv venv
source .venv/bin/activate
uv sync --group devOptional extras:
uv sync --group dev --extra mcp
uv sync --group dev --extra mlx
uv sync --group dev --extra montyTypeScript work happens in ts/:
cd ts
npm installPython:
cd autocontext
uv run ruff check src tests
uv run mypy src
uv run pytestTypeScript:
cd ts
npm run lint
npm testTUI-related TypeScript work:
cd ts
npm install
npm testautocontext/: Python package, CLI, API server, and teststs/: published TypeScript package, Node CLI, MCP server, and bundled Ink terminal UIscripts/: repo maintenance and protocol generation helpers
- The Python package name and CLI are
autocontext/autoctx. - Environment variables use the
AUTOCONTEXT_prefix. - Prefer targeted tests for touched modules before running full suites.
- Keep protocol changes in sync with
scripts/generate_protocol.py. - Avoid rewriting historical plan docs unless the change is user-facing or release-facing.
When a change affects public commands, environment variables, package names, or agent-facing workflows, update the relevant docs in the same PR:
README.mddocs/README.mdautocontext/README.mdts/README.mdexamples/README.mdautocontext/docs/agent-integration.mdAGENTS.mdCHANGELOG.md
Publishing is split by package and uses GitHub OIDC trusted publishing rather than long-lived PyPI or npm tokens.
- Python publishes through
.github/workflows/publish-python.yml- tag trigger:
py-v<version> - manual trigger:
workflow_dispatchfrommain - environment:
publish-python
- tag trigger:
- TypeScript publishes through
.github/workflows/publish-ts.yml- tag trigger:
ts-v<version> - manual trigger:
workflow_dispatchfrommain - environment:
publish-ts
- tag trigger:
- Pi extension publishes through
.github/workflows/publish-pi-autocontext.yml- tag trigger:
pi-v<version> - manual trigger:
workflow_dispatchfrommain - environment:
publish-pi-autocontext
- tag trigger:
Release notes:
- Keep the GitHub environment branch/tag policy restricted to
mainand the matching tag namespace. - The trusted publisher registration in PyPI and npm must match the repo, workflow filename, and environment name exactly.
- No
NPM_TOKEN,NODE_AUTH_TOKEN, or PyPI API token should be required for the publish jobs. - After cutover, remove the old combined
.github/workflows/publish.ymlpublisher registration from PyPI and npm.
- ABC — for internal class hierarchies where subclasses share implementation via inheritance (e.g.,
ScenarioInterface,LLMProvider,AgentRuntime,Notifier) - Protocol — for duck-typed integration points where implementors shouldn't need to import the base class (e.g.,
ExecutionEngine,Evaluator,DictSerializable,ReplWorkerProtocol) - New root ABCs (
class X(ABC)) should define at least one@abstractmethod; subclasses that inherit an abstract contract from another ABC do not need to redeclare one.
- Use
dict[str, Any]for JSON-like dicts (notdict[str, object]) - Prefer
TypedDictwhen the dict shape is known at all call sites - Use
Mapping[str, Any]for read-only dict parameters
- Use
Sequence[X]for read-only list parameters in public API functions - Use
list[X]for return types and parameters that are mutated - Use
Mapping[str, X]for read-only dict parameters (already used inScenarioInterface)
LlmFn = Callable[[str, str], str]— defined inagents/types.py- Use
from enum import StrEnum(notimport enum+enum.StrEnum)
- Use
logger = logging.getLogger(__name__)(lowercase, per PEP 8)
- Keep changes scoped to one feature or cleanup theme.
- Update docs and examples when renaming commands, env vars, or package paths.
- Include verification notes for the checks you ran.