agentleFS
neoneyeneoneye/PlanExe/worker_plan/AGENTS.md

PlanExe / worker_plan

AGENTS.md402 starsChanged 3 months agoMITView on GitHub

Scope: FastAPI worker service and shared workerplaninternal/workerplanapi packages used by frontends and database workers. Keep interfaces stable across consumers. - For tasks with multiple LLM calls, use the message parameter to distinguish them: LLMChatError(cause=e, message="LLM chat interaction 2 failed"). - Error classification: classifyerror() in usagemetrics.py maps raw exception strings to short categories (invalidjson, timeout, ratelimit, etc.) stored in usagemetrics.jsonl. Unknown errors preserve a truncated errordetail field. Each Luigi pipeline task lives in its own file under stages/. This enables: -…

  • Reads credentials

We split this AGENTS.md into the rules it gives an agent

12 rules. About 0 are common, 2 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep request/response shapes and endpoint paths backward compatible.

    line 9
  2. Very specific:

    Avoid renaming response fields like run_id, run_dir, display_run_dir.

    line 10
  3. Very specific:

    When changing pipeline behavior, keep the subprocess invocation in start_pipeline_subprocess consistent with worker_plan_internal.

    line 15
  4. Very specific:

    Keep PlanExeDotEnv.load().update_os_environ() early so .env overrides work.

    line 17
  5. Very specific:

    Keep planning logic in worker_plan_internal (pipeline stages: prompt parsing -> LLM planning -> file/report output).

    line 21
  6. Very specific:

    If new environment variables or endpoints are added, update worker_plan/README.md and any Railway docs.

    line 25
  7. Very specific:

    When an LLM call fails inside a pipeline task, raise LLMChatError (from worker_plan_internal.llm_util.llm_errors), not a bare ValueError.

    line 29
  8. Very specific:

    Create stages/<stage_name>.py with one task class

    line 62
  9. Very specific:

    Import PlanTask from worker_plan_internal.plan.run_plan_pipeline

    line 63
  10. Distinctive:

    Import upstream task dependencies from sibling stage files

    line 64
  11. Very specific:

    Add the new task to stages/full_plan_pipeline.py's requires() dict

    line 66
  12. Very specific:

    Prefer unit tests over manual server checks.

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.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
AGENTS.md

worker_plan agent instructions

Scope: FastAPI worker service and shared worker_plan_internal/worker_plan_api packages used by frontends and database workers. Keep interfaces stable across consumers.

Guidelines

  • Preserve the public API contract in worker_plan/app.py:
    • Keep request/response shapes and endpoint paths backward compatible.
    • Avoid renaming response fields like run_id, run_dir, display_run_dir.
  • Artifact contract: /runs/{run_id}/zip must not include track_activity.jsonl in downloadable zips.
  • Maintain the run directory conventions (PlanExe_...); run outputs go under {PLANEXE_CONFIG_PATH}/run/.
  • When changing pipeline behavior, keep the subprocess invocation in start_pipeline_subprocess consistent with worker_plan_internal.
  • Keep PlanExeDotEnv.load().update_os_environ() early so .env overrides work.
  • CRITICAL: worker_plan_api must stay lightweight. Allowed imports are stdlib, typing, dataclasses, enum, and pydantic. Do not import llama_index, fastapi, httpx, numpy, pandas, or torch there.
  • Keep planning logic in worker_plan_internal (pipeline stages: prompt parsing -> LLM planning -> file/report output).
  • Other services may import worker_plan_api for types/helpers; they must not import worker_plan_internal.
  • If new environment variables or endpoints are added, update worker_plan/README.md and any Railway docs.

LLM Error Handling

  • When an LLM call fails inside a pipeline task, raise LLMChatError (from worker_plan_internal.llm_util.llm_errors), not a bare ValueError. LLMChatError preserves the root cause and generates an error_id UUID for cross-referencing logs with usage_metrics.jsonl rows.
  • Standard pattern (30+ call sites):
    from worker_plan_internal.llm_util.llm_errors import LLMChatError
    try:
        result = llm_executor.run(execute_function)
    except PipelineStopRequested:
        raise
    except Exception as e:
        llm_error = LLMChatError(cause=e)
        logger.debug(f"LLM chat interaction failed [{llm_error.error_id}]: {e}")
        logger.error(f"LLM chat interaction failed [{llm_error.error_id}]", exc_info=True)
        raise llm_error from e
  • For tasks with multiple LLM calls, use the message parameter to distinguish them: LLMChatError(cause=e, message="LLM chat interaction 2 failed").
  • Error classification: classify_error() in usage_metrics.py maps raw exception strings to short categories (invalid_json, timeout, rate_limit, etc.) stored in usage_metrics.jsonl. Unknown errors preserve a truncated error_detail field.

Pipeline Stages (worker_plan_internal/plan/nodes/)

Each Luigi pipeline task lives in its own file under stages/. This enables:

  • Multiple agents working on different stages without merge conflicts
  • self_improve/ targeting individual step files
  • Easy DAG insertion (create new file, update downstream requires())

Convention for new stages

  1. Create stages/<stage_name>.py with one task class
  2. Import PlanTask from worker_plan_internal.plan.run_plan_pipeline
  3. Import upstream task dependencies from sibling stage files
  4. Declare dependencies via requires() returning upstream task(s)
  5. Add the new task to stages/full_plan_pipeline.py's requires() dict

Framework location

run_plan_pipeline.py contains only shared framework:

  • PlanTask (base class for all stages)
  • ExecutePipeline, HandleTaskCompletionParameters, PipelineProgress
  • _task_class_to_step_label, configure_logging
  • __main__ entry point

Testing

  • Prefer unit tests over manual server checks. Run python test.py from repo root; worker tests live under worker_plan/worker_plan_internal/**/tests and worker_plan/worker_plan_api/tests.
  • Error handling tests: worker_plan/tests/test_llm_errors.py and worker_plan/tests/test_usage_metrics.py.

Download now (ZIP)

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. PlanExeOrg/PlanExe★ 402100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository12 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.