|
| 1 | +# Generated by specsmith migrate m001 |
| 2 | +# Edit this file; original MD kept as view. |
| 3 | + |
| 4 | +content: '# Context Window Management and Credit Optimization |
| 5 | +
|
| 6 | +
|
| 7 | + ## Core principle |
| 8 | +
|
| 9 | + Treat unnecessary credit consumption as a process defect. |
| 10 | +
|
| 11 | +
|
| 12 | + ## Session load protocol (lazy loading) |
| 13 | +
|
| 14 | + On session start, load only: |
| 15 | +
|
| 16 | + - `AGENTS.md` (in full) |
| 17 | +
|
| 18 | + - `docs/governance/RULES.md` |
| 19 | +
|
| 20 | + - `docs/governance/CONTEXT-BUDGET.md` |
| 21 | +
|
| 22 | + - Last ~300 lines of `LEDGER.md` |
| 23 | +
|
| 24 | +
|
| 25 | + Load on demand: |
| 26 | +
|
| 27 | + - `docs/governance/SESSION-PROTOCOL.md` — when preparing proposals or ledger entries |
| 28 | +
|
| 29 | + - `docs/governance/LIFECYCLE.md` — when checking phase readiness or advancing |
| 30 | +
|
| 31 | + - `docs/governance/ROLES.md` — when role boundaries are relevant |
| 32 | +
|
| 33 | + - `docs/governance/VERIFICATION.md` — when testing or accepting work |
| 34 | +
|
| 35 | + - `docs/governance/DRIFT-METRICS.md` — when running `audit` |
| 36 | +
|
| 37 | + - `docs/REQUIREMENTS.md` — first ~200 lines, expand by section |
| 38 | +
|
| 39 | + - `docs/TESTS.md` — first ~200 lines, expand by section |
| 40 | +
|
| 41 | + - `docs/ARCHITECTURE.md` — first ~40 lines, expand by section |
| 42 | +
|
| 43 | +
|
| 44 | + ## During a session |
| 45 | +
|
| 46 | + - NEVER re-read a file already in context unless modified since last read |
| 47 | +
|
| 48 | + - Use line ranges for files > ~200 lines |
| 49 | +
|
| 50 | + - Prefer grep/semantic search over reading entire files |
| 51 | +
|
| 52 | + - Batch file reads into a single call |
| 53 | +
|
| 54 | + - Summarize rather than echo file contents |
| 55 | +
|
| 56 | + - Do not repeat proposals after creating them |
| 57 | +
|
| 58 | +
|
| 59 | + ## Conversation summarization recovery |
| 60 | +
|
| 61 | + If the conversation is summarized or truncated, re-read AGENTS.md in full before |
| 62 | + any further actions. |
| 63 | +
|
| 64 | +
|
| 65 | + ## Response economy |
| 66 | +
|
| 67 | + - No echoing file contents back |
| 68 | +
|
| 69 | + - No repeating proposal content after creation |
| 70 | +
|
| 71 | + - No "status theater" messages that add no information |
| 72 | +
|
| 73 | + - Provide only evidence needed to support conclusions |
| 74 | +
|
| 75 | +
|
| 76 | + ## Efficient verification order |
| 77 | +
|
| 78 | + 1. Static validation / lint / syntax (cheapest) |
| 79 | +
|
| 80 | + 2. Type checks / unit tests |
| 81 | +
|
| 82 | + 3. Integration tests |
| 83 | +
|
| 84 | + 4. Expensive builds / hardware flows (most expensive) |
| 85 | +
|
| 86 | +
|
| 87 | + If a cheaper check fails, fix that before running more expensive checks. |
| 88 | +
|
| 89 | +
|
| 90 | + ## Cost tiers |
| 91 | +
|
| 92 | + - **low** — docs-only, single-file edits, small scaffolds |
| 93 | +
|
| 94 | + - **medium** — multi-file implementation, routine refactors, standard test runs |
| 95 | +
|
| 96 | + - **high** — architecture changes, large builds, broad audits |
| 97 | +
|
| 98 | +
|
| 99 | + ## Credit tracking |
| 100 | +
|
| 101 | +
|
| 102 | + This project tracks AI credit spend automatically. At the end of each session: |
| 103 | +
|
| 104 | +
|
| 105 | + 1. Record usage: `specsmith credits record --model <model> --provider <provider> |
| 106 | + --tokens-in <N> --tokens-out <N> --task "<description>"` |
| 107 | +
|
| 108 | + 2. Check budget: `specsmith credits summary` |
| 109 | +
|
| 110 | + 3. If budget alerts appear, review with: `specsmith credits analyze` |
| 111 | +
|
| 112 | +
|
| 113 | + Budget configuration: `specsmith credits budget --cap <USD> --alert-pct 80` |
| 114 | +
|
| 115 | + Credit data stored in `.specsmith/credits.json` (gitignored). |
| 116 | +
|
| 117 | + ' |
| 118 | +generated_by: specsmith migrate (m001) |
| 119 | +kind: context-budget |
| 120 | +source_md: docs/governance/CONTEXT-BUDGET.md |
0 commit comments