Repository navigation
Description
Overview
Reduce repeated instruction and tool-result context in Codex after grouping the workspace into family folders. Preserve provider delegation, approval, review, Heart and release controls.
Plan
- Slim root, Brain and Mind instruction surfaces and retain on-demand details.
- Read workflow references only for the current step and execution environment.
- Bound tool output and document compact completed-phase handoffs.
- Resolve grouped/flat repository paths consistently.
- Measure static context reductions and validate generated instructions, paths and workflow invariants.
Detailed implementation plan
Work classification: library (Brain conductor decision; infrastructure repositories).
Primary repo: PyAutoBrain. Also PyAutoMind.
Branch: feature/codex-context-efficiency.
Worktree: /home/jammy/Code/PyAutoLabs/.worktrees/codex-context-efficiency.
Branch survey: Brain main clean; Mind main with unrelated deletion of draft/maintenance/pyautobrain/workspace_resolver_fanout.md, preserved. No active claims on either repo.
Key files: Brain AGENTS.md, bin/install.sh and workspace-policy generator, skills/WORKFLOW.md, MODEL_DELEGATION.md, start_dev and prm procedure/reference files; Mind AGENTS.md, repos_sync generation surfaces, and context-size reporting. Keep explanatory detail in linked references; generated blocks change at their owner. Reuse the existing repository resolver rather than invent another layout heuristic. Keep flat bundles and remote clones supported. Reduce start/close mandatory reading without dropping gates; unchanged instructions need not be reread. Report lines/bytes and approximate tokens with explicit static-estimate limits. Validate installer and repos_sync drift, focused existing workflow tests, grouped/flat paths and independent review. No model configuration changes, merge or release authorization.
Original Prompt
Reduce repeated Codex context after workspace regrouping
Type: maintenance
Target: organs
Repos:
- @PyAutoBrain
- @PyAutoMind
Difficulty: medium
Autonomy: supervised
Priority: high
Status: draft
Filed: 2026-09-19
Original request
Can you do another review of codex token usage, is there anything we can do to be more efficient? We did one recently and it helped, but theres more tasks with astra you can review to assess and we did the reorg of PyAutoLabs
Approval of the resulting five recommendations:
ok do all of that
Approved scope
- Slim root, Brain and Mind instructions; preserve mandatory policies and provider-specific delegation.
- Make workflow reference reads conditional on the environment and current step; reuse unchanged loaded instructions.
- Bound tool output: targeted reads, summaries, failure excerpts and external full logs.
- Correct grouped-layout path guidance using the existing repository resolver, preserving flat task-bundle/remote layouts.
- Define compact handoffs at completed phase boundaries without interrupting authorized work or weakening independent review.
Keep Astra Medium unchanged, retain concise folder routing guides, and preserve every safety, approval, review, Heart and release gate. Related broader backlog: reduce_session_token_load.md; Cortex/Memory prose and completion-record redesign are outside this task.
Implementation and validation
Use feature/codex-context-efficiency in isolated Brain and Mind worktrees. Move explanatory AGENTS prose to references, update authoritative generators rather than generated copies, shorten and index start/close workflow instructions, and add a deterministic context-size report/budget check for maintained surfaces. Validate generated blocks, grouped/flat path examples, existing installer/workflow tests and independent review. Record before/after bytes and lines; do not claim measured runtime savings from static size reductions.
Activity
Jammy2211 commentedon Sep 19, 2026
Implementation is ready for review in PyAutoBrain#404 and PyAutoMind#425.
release validation incomplete: no rehearsal for current source. Development PRs only.Jammy2211 commentedon Sep 19, 2026
Final validation: Brain 982 tests and Mind 582 tests passed; Sphinx passes with warnings treated as errors. Both PRs now have green applicable GitHub checks. Independent review includes the docs-build and isolated-checkout follow-up fixes (Brain 68889b0 / Mind 335d0b3f). Root activation remains prepared for after both merges, per docs/context_efficiency.md. No merge performed.
Jammy2211 commentedon Sep 19, 2026
Shipped in #404 and PyAutoLabs/PyAutoMind#425; both merged after all applicable CI jobs passed.
Implemented all five approved token-efficiency changes and activated the root instructions. Combined maintained AGENTS size is 40.7% smaller (static bytes; no runtime savings claim). Brain 982 and Mind 582 tests passed, docs built with warnings as errors, and independent review was CLEAN. Root instruction and context-budget checks pass.