{"record":{"id":"6dbc82be75eb4b7d","repo":"can1357/oh-my-pi","slug":"could-not-find-agent-compaction-prompts","errorCode":null,"errorMessage":"Could not find agent compaction prompts","messagePattern":"Could not find agent compaction prompts","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/adapters/snapcompact.py","lineNumber":50,"sourceCode":"import json\nimport re\nimport sys\nfrom concurrent.futures import ThreadPoolExecutor\nfrom pathlib import Path\n\nHERE = Path(__file__).resolve().parent\nRESEARCH = HERE.parents[2] / \"snapcompact\" / \"research\"\n\n\ndef find_agent_prompts() -> Path:\n    for parent in HERE.parents:\n        for candidate in (\n            parent / \"packages\" / \"agent\" / \"src\" / \"compaction\" / \"prompts\",\n            parent / \"agent\" / \"src\" / \"compaction\" / \"prompts\",\n        ):\n            if candidate.exists():\n                return candidate\n    raise FileNotFoundError(\"Could not find agent compaction prompts\")\n\n\nsys.path.insert(0, str(RESEARCH))\n\nimport squad  # noqa: E402\nfrom anthropic_api import complete, image_block, load_api_key  # noqa: E402\nfrom bdf import VARIANTS, FontCfg, capacity, render  # noqa: E402\n\nAGENT_PROMPTS = find_agent_prompts()\nCACHE = RESEARCH / \".cache\"\nQA_CACHE = CACHE / \"qa\"\nRESULTS = RESEARCH / \"results\"\n\nFONTS = {\n    \"8x13\": FontCfg(\"8x13\", \"8x13\", 8, 13),\n    \"7x13\": FontCfg(\"7x13\", \"7x13\", 7, 13),\n    \"6x12\": FontCfg(\"6x12\", \"6x12\", 6, 12),\n    \"6x10\": FontCfg(\"6x10\", \"6x10\", 6, 10),","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/adapters/snapcompact.py#L32-L68","documentation":"find_agent_prompts locates the agent package's compaction prompt directory by probing candidate paths relative to the repo root (packages/agent/src/compaction/prompts or agent/src/compaction/prompts). If none exist, the script raises this FileNotFoundError because snapcompact experiments require those prompt files to build compaction contexts.","triggerScenarios":"Running snapcompact.py outside a checkout of this repo, from a directory layout without the agent package (e.g. installed package, shallow copy, renamed/sparse checkout), or after the prompts directory was moved.","commonSituations":"Running the research adapter standalone on a machine without the full monorepo; running from a packaged/deployed copy where source dirs are absent; a refactor moved compaction prompts and the hardcoded candidates are stale.","solutions":["Run the script from within a full clone of the oh-my-pi monorepo containing packages/agent/src/compaction/prompts.","Set/verify the script's root detection (parent directory derivation) so candidates resolve — run with the correct cwd or adjust the parent logic.","Update the candidate list in find_agent_prompts if the prompts directory was relocated.","Ensure the path exists: ls packages/agent/src/compaction/prompts before running."],"exampleFix":"# before\ncd /tmp && python adapters/snapcompact.py ...   # FileNotFoundError\n# after\ncd /path/to/oh-my-pi && python packages/metaharness/src/adapters/snapcompact.py ...","handlingStrategy":"fallback","validationCode":"import pathlib\nroot = pathlib.Path(\"packages/agent/src/compaction/prompts\")\nassert root.is_dir(), f\"run from repo root; missing {root}\"","typeGuard":null,"tryCatchPattern":"try:\n    prompts = find_agent_prompts()\nexcept FileNotFoundError:\n    sys.exit(\"snapcompact must run inside a full oh-my-pi checkout with packages/agent/src/compaction/prompts\")","preventionTips":["Run research adapters from the monorepo root of a full clone.","After moving prompt directories, update the candidate list in find_agent_prompts.","Pre-check the prompts directory exists before long-running experiment setup."],"tags":["filesystem","missing-directory","path-resolution"],"backgroundTag":"file-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}