Scope: repo-level guardrails for PlanExe services and shared packages.
Always check the package-level AGENTS.md for file-specific rules
(use rg --files -g 'AGENTS.md' if you are unsure).
database_api: shared SQLAlchemy models for DB-backed services.worker_plan/worker_plan_api: shared API types/helpers (must stay lightweight).worker_plan: FastAPI service that runs the pipeline.frontend_single_user: Gradio UI (local mode).frontend_multi_user: Flask UI (hosted mode) + Postgres.open_dir_server: local host opener (security critical).worker_plan_database: DB-backed worker that polls tasks.mcp_cloud: MCP stdio server + HTTP wrapper; primary cloud deployment, secondary Docker setup for advanced users, tertiary venv workflow for developers; bridges MCP tools to PlanExe DB/worker_plan.mcp_local: local MCP proxy that forwards tool calls tomcp_cloudand downloads artifacts.
- Keep
worker_planHTTP endpoints and response shapes backward compatible. - Preserve shared SQLAlchemy models in
database_api(nullable defaults for new columns). - Run directory naming defaults live in
worker_plan/worker_plan_api/generate_run_id.py. Current defaults: single-user uses timestamped IDs; multi-user can use UUIDs. Verify in code before changing run-id formats. - Keep prompt catalog UUIDs stable when used as defaults; they live in
worker_plan/worker_plan_api/prompt/data/*.jsonl.
- Never commit directly to
main. Always create a feature branch (e.g.feat/short-description,fix/short-description) and commit there. Push the branch and open a PR so CI can verify the changes. - Do not add real API keys or passwords to
.env,.env.*, or anyllm_config/*.jsonfile. - Treat
track_activity.jsonlas sensitive (may contain API keys/tokens). Never expose it to end users. Storetrack_activity.jsonlinPlanItem.run_track_activity_jsonland keep it out of downloadable zips at artifact creation time. Legacy snapshots may be sanitized at download time, but new snapshots should be served directly without unzip/recompress. - Do not change run-dir validation or path-allowlist logic in
open_dir_server/app.pyunless explicitly instructed. - Shared packages (
database_api,worker_plan_api) must not import service apps (frontend_*,worker_plan_database,open_dir_server,worker_plan.app). - If a service needs shared logic, move it into a shared package rather than importing across service boundaries.
- Canonical env keys live in
.env.docker-example,.env.developer-example, andworker_plan/worker_plan_api/planexe_dotenv.py. Read those before adding or renaming env vars.
.envand thellm_config/directory are expected in the repo root for Docker setups.- Profile file mapping:
baseline->llm_config/baseline.jsonpremium->llm_config/premium.jsonfrontier->llm_config/frontier.jsoncustom->llm_config/custom.json(orPLANEXE_LLM_CONFIG_CUSTOM_FILENAME)
PLANEXE_MODEL_PROFILEselects which profile file is used at runtime.- Baseline is the default profile and fallback if another selected profile file is missing.
- Use
PLANEXE_*env vars; prefer existing defaults when adding new ones. - Do not assume ports; read
docker-compose.ymlor the service env defaults (PLANEXE_*_PORT) before any manual verification.
PLANEXE_POSTGRES_PORTchanges the host port mapping only; containers still connect to Postgres on 5432.- The
Open Output Dirbutton requires the hostopen_dir_serverandPLANEXE_OPEN_DIR_SERVER_URL(OS-specific URLs live indocs/docker.md). - Keep
PLANEXE_HOST_RUN_DIRconsistent with run dir mounts so outputs land in the expected host folder.
- When changing Docker services, env defaults, or port mappings, update
docker-compose.yml,docker-compose.md, anddocs/docker.mdtogether. - When changing single-user quickstart or LLM env requirements (e.g.
OPENROUTER_API_KEY), updatedocs/getting_started.md. - When changing local dev startup steps or the test command, update
docs/install_developer.md. - For README links, prefer absolute
https://docs.planexe.org/...URLs so GitHub readers land on the published docs site.
- Prefer unit tests over manual curl/server checks.
- Run
python test.pyfrom repo root for existing coverage. - If you change logic without tests, add a unit test close to the code.
- Do not start services or run curl checks unless explicitly requested.
- Type hints: add to all public function signatures.
- Async/sync: FastAPI code can be
async; Flask routes must stay sync. - Error handling: do not use bare
except:; log stack traces. - Logging: use
logging(avoidprint()in service code). - Formatting/linting: no repo-wide formatter is configured; follow existing file style and do not add new lint tools unless requested.
- In Pydantic models used for LLM structured output, use
Literal["a", "b"]instead of anEnumtype for field annotations. - Reason:
Enumfields causemodel_json_schema()to emit$defs/$refindirection. Some structured-output backends (e.g. MLX Outlines for local inference) cannot resolve$defs/$refand fail silently or error out.Literalproduces a flat schema with an inlineenumarray, which is universally supported. - Keep the canonical
str(Enum)class in the same module as the single source of truth for valid values; theLiteralduplicates those values in the schema annotation only. - A CI parity test (
test_enum_literal_parity.py) asserts that everyLiteralfield stays in sync with its correspondingEnum. If you add or rename an Enum member, update the matchingLiteraland vice versa.
- Canonical version is defined in each package
pyproject.toml.
worker_planandfrontend_multi_user: add deps in theirpyproject.toml.frontend_single_userandworker_plan_database: add deps inrequirements.txt.- Do not
pip installad-hoc without recording the dependency in the package manifest.
We are evolving from a "Plan Generator" (rough drafts) to a "Plan Execution Engine" (enterprise-grade). New features and proposals should align with this shift:
- Trust & Rigor: AI output is untrusted by default.
- Favor features that verify, cite, and stress-test claims (e.g., Evidence Ledgers, Monte Carlo sims).
- Avoid features that just "generate more text" without validation.
- Execution Focus: A plan is a living tool, not a static PDF.
- Favor features that monitor reality vs. plan (e.g., drift monitors, readiness gates).
- Ensure data structures support dynamic updates (databases over documents).
- Scale: We are building for users who manage 100+ plans.
- Favor features that automate sorting, ranking, and routing (e.g., Elo ranking, automated dispatch).
PlanExe is designed to be used by both humans and autonomous agents.
- OpenClaw (an open-source agent framework) is a first-class citizen.
- We support MCP (Model Context Protocol) to allow bots to natively call PlanExe tools.
- When designing APIs, assume the caller might be a Raspberry Pi running OpenClaw, not just a human with a browser.