/** * Canonical generate-adrs prompt for ContextAtlas. * * Substantive interpretive content shipped at v0.7 Step 2.2.a.2 per * locked draft + Refinements 1-3 applied at Travis adjudication * surface. Mirrors `src/extraction/prompt.ts` shape conventions * (JSON-structured output, severity taxonomy parallel to extraction). * * Path-γ pattern (v0.7 Step 1.4b inheritance): `contextatlas * show-generate-prompt` CLI subcommand surfaces this constant to * Skills (`.claude/skills/generate-adrs/SKILL.md`) without leaking * package internals. Constant content is canonical; do not duplicate * in SKILL.md. * * Calibration approach: v0.7-ship-bearing-cycle iteration scope (Step * 2.2.a.2 substantive interpretive work + Step 2.2.b empirical * verification at Rich cold-start + Rich + django/deps reference- * context-aided). v0.1-v0.5 multi-cycle prompt iteration scope NOT in * v0.7 envelope. * * Naming convention note (mirrors EXTRACTION_PROMPT): the model's * JSON output uses snake_case (e.g., `severity_summary`, * `markdown_body`); the rest of the codebase uses camelCase. The * generation pipeline transforms snake_case → camelCase at the * boundary; the prompt instructs snake_case explicitly so the model's * output is predictable to parse. */ export declare const GENERATE_ADRS_PROMPT = "You are generating Architectural Decision Records (ADRs) for the codebase below. ADRs document non-obvious architectural decisions \u2014 choices that shaped the codebase, constraints that must be preserved, or design tradeoffs that future maintainers need to understand.\n\n# Audience and purpose\n\nYour audience is a senior engineer joining this project in 18 months. They need to understand WHY each decision was made, not just WHAT it was. Each ADR must equip them to:\n\n- Defend the decision in a code review against someone proposing the alternative.\n- Recognize when a proposed change would silently break the invariant the ADR records.\n- Distinguish between cosmetic changes (safe) and decision-level changes (require ADR amendment).\n\nADRs that read as topic-level summaries (\"Rich uses duck typing for renderables\") are insufficient. ADRs that read as deep investigations (\"Rich uses duck typing for renderables because subclass-based extension would require users to either monkey-patch or wrap external types; this rejects two specific alternatives \u2014 class hierarchy and registry \u2014 for reasons visible at `rich/protocol.py:is_renderable` and the `__subclasshook__` pattern in `rich/abc.py:RichRenderable`\") are the target.\n\n# Investigative discipline (load-bearing)\n\nBefore writing ANY ADR, you MUST investigate the codebase substantively for each architectural decision candidate:\n\n1. **Read the load-bearing implementation files** for each candidate \u2014 not just enumerate symbol names from a directory listing. Read the actual function bodies, class definitions, interface declarations, error handling paths.\n\n2. **Cite specific line numbers** for the symbols you reference. `src/router.ts:98`, `rich/console.py:_write_buffer at line 1652`, `src/types.ts:127+`. An ADR without line-level grounding is shallow by definition.\n\n3. **Quote specific code patterns** where they illustrate the decision. A 3-15 line code snippet in the Decision or Rationale section is substantively more useful than a verbal description of the same code.\n\n4. **Enumerate alternatives considered** with substantive detail. Name specific alternatives (not \"other approaches were considered\"). For each alternative, explain what it would have required and why it was rejected. Where the codebase shows evidence of alternatives (commented-out code, \"TODO: consider X\" patterns, abandoned-approach commits, comparison tables in comments), cite them.\n\n5. **Track cross-file dependencies and patterns** that participate in the decision. A decision is rarely localized to one file; the ADR should surface the full surface area.\n\nThe depth ceiling for ADRs generated from cold investigation (no prior knowledge of the codebase's history) is bounded \u2014 you cannot recover original-author intent, cycle history, or production-incident-driven decisions that aren't visible in code/comments. Aim for what cold investigation CAN reach: line-level grounding, code-pattern citation, alternatives inferred from code structure, failure modes visible in error-handling code.\n\n# Output schema\n\nOutput strictly valid JSON matching this exact schema:\n\n{\n \"adrs\": [\n {\n \"number\": ,\n \"title\": \"\",\n \"symbols\": [\"\"],\n \"severity_summary\": \"hard\" | \"soft\" | \"context\",\n \"markdown_body\": \"\"\n }\n ]\n}\n\n# ADR markdown_body structure\n\nEach ADR follows this template:\n\n```\n---\nid: ADR-NN\ntitle: \nstatus: accepted\nseverity: hard | soft | context\nsymbols:\n - \n - \n---\n\n# ADR-NN: \n\n## Context\n\n<Substantive paragraphs \u2014 typically 2 or more \u2014 establishing the problem\nspace, the constraints or forces shaping the decision, and the stakes if\nthe decision is gotten wrong. Reference specific symbols with line\nnumbers (`src/router.ts:98`); include code snippets where they\nillustrate the problem; name specific alternatives considered.>\n\n## Decision\n\n<What was decided? Be specific. Enumerate sub-rules (MUST / MUST NOT)\nwhere the decision has multiple load-bearing parts. Reference exact\nfile locations and symbol names. Include code snippets that illustrate\nthe decision pattern in practice.>\n\n## Rationale\n\n<Why this decision over alternatives? Make multiple distinct cases\n(typically 3-7 bullets or paragraphs). For each alternative considered,\nexplain what it would have required and why it was rejected. Cite\nspecific code patterns or invariants the decision preserves.>\n\n## Consequences\n\n<What does this decision enable, constrain, or imply? Surface concrete\nfailure modes (e.g., \"Forgetting normalizePath() at an ingest boundary\ncreates a bifurcation where some IDs use backslash\"); review-time\ninvariants (e.g., \"any code that tries to extract line from ID is\nbroken\"); downstream code patterns that depend on this decision.\nGeneric statements like \"this enables flexibility\" or \"this may have\nimplications\" are NOT sufficient \u2014 name specific failure modes and\ninvariants.>\n```\n\n# Calibration examples \u2014 depth contrast\n\nGOOD Context section (target depth):\n\n> Configuration surface is where MVP projects either stay focused or get\n> dragged into scope creep. Every \"just one more config option\" adds\n> parsing complexity, documentation burden, and user confusion. Every\n> inheritance chain (\"my project config inherits from my team config\")\n> doubles the mental model.\n>\n> ContextAtlas's config needs are limited: language list, ADR path, doc\n> globs, git settings, extraction model, and atlas sync options. Roughly\n> seven top-level sections. Deliberately compact.\n\n(Establishes stakes; names what scope creep looks like; explains\nconstraint with specifics.)\n\nSHALLOW Context section (do NOT write like this):\n\n> ContextAtlas needs configuration. The config defines languages and paths.\n\n(No stakes; no alternatives; no specifics.)\n\nGOOD Rationale enumeration (target depth):\n\n> - **A single file is greppable, copyable, reviewable in a single PR.**\n> - **No inheritance means no debugging of \"what config is actually\n> active?\" questions.**\n> - **YAML is the standard for dev-tool config files** (GitHub Actions,\n> Docker, Kubernetes, CircleCI). Not introducing a less-familiar format.\n\n(Multiple distinct cases; each names a concrete alternative or\ncounterfactual; references specific comparables.)\n\nSHALLOW Rationale (do NOT write like this):\n\n> - Simple is better.\n> - YAML is standard.\n> - Reduces complexity.\n\n(No alternatives named; no concrete grounding.)\n\nGOOD Consequences section (target depth):\n\n> - Moving a symbol to a different file changes its ID. A file split or\n> move from src/orders/ to src/billing/ produces a new ID and\n> invalidates claims bound to the old one. This is correct behavior \u2014\n> the symbol has been relocated \u2014 and incremental reindex rebinds\n> claims as part of its normal flow.\n> - The Symbol record is the authoritative source of line information.\n> Consumers that need a line number (for jump-to-definition, log\n> output, etc.) read the `line` field from the Symbol record, never\n> parse it out of the ID. Any code that tries to extract line from ID\n> is broken.\n> - normalizePath() is a single enforcement point. It MUST be called at\n> every ingest boundary: reading file paths from LSP, parsing config,\n> importing atlas.json, scanning ADR directories. Forgetting it\n> anywhere creates a bifurcation where some IDs use backslash and some\n> use forward-slash, silently producing \"duplicate\" symbols. Code\n> review should flag any path-handling code that doesn't go through\n> this utility.\n\n(Named failure modes; review-time invariants; concrete downstream\nimpacts.)\n\nSHALLOW Consequences (do NOT write like this):\n\n> - This enables flexibility.\n> - May have implications for future development.\n> - Users should be aware of the trade-off.\n\n(No named failure modes; no review invariants; no concrete grounding.)\n\n# What counts as an architectural decision (target these)\n\n- Module boundaries and dependency direction (which module is allowed to import which)\n- Cross-cutting invariants (e.g., \"only X module is allowed to call Y API\")\n- Choice of abstraction (e.g., \"Strategy pattern for dispatch\" / \"Factory for object construction\")\n- Data flow / persistence decisions (e.g., \"single SQLite file\" / \"atlas.json is the committed artifact\")\n- Interface contracts that shape downstream code (e.g., \"all language adapters expose the same method signatures\")\n- Performance / cost / correctness tradeoffs (e.g., \"extraction runs once at index time; queries are atlas-only\")\n- Protocol / dunder / extensibility-point design (e.g., duck-typed renderable protocol)\n- Backend / platform abstraction patterns (e.g., legacy Windows renderer as dedicated backend, not feature flag)\n\n# What is NOT an architectural decision (skip these)\n\n- Specific implementation details (\"function uses a for-loop\")\n- Naming choices (unless they encode a convention referenced elsewhere)\n- One-off bug fixes or refactors visible in git history but not architectural\n- Test scaffolding choices\n- Build / tooling configuration unless it shapes runtime behavior\n\n# Calibration \u2014 number of ADRs\n\n- Small codebase (<1k LOC): 3-5 ADRs reasonable\n- Substantial codebase (~1k-50k LOC): 5-15 ADRs target (substantive launch scope)\n- Very large codebase (>50k LOC): 15-30 ADRs reasonable; focus on top-level architectural decisions rather than per-module exhaustive coverage\n- One ADR per major architectural decision. Do NOT create one ADR per file or one ADR per module.\n- Fewer well-grounded ADRs are better than more speculative ones.\n- An ADR exceeding 600 lines is probably bundling multiple decisions; split into two narrower-scoped ADRs instead.\n\n# Symbol reference convention\n\n- When referencing code in ADR text, use canonical symbol identifiers in the form `path/to/file.ts:SymbolName` (e.g., `src/queries/symbol-context.ts:buildBundle`).\n- Where helpful, include line numbers: `src/router.ts:98` or `rich/console.py:Console at line 1652`.\n- For module-level references, use the path alone (e.g., `src/extraction/`).\n- For external packages, use the package name (e.g., `@anthropic-ai/sdk`).\n\n# Severity summary per ADR\n\n- \"hard\": the ADR documents a constraint or invariant that must be preserved (violation is a bug or breaks the architecture).\n- \"soft\": the ADR documents a preference, recommendation, or tradeoff (violation is suboptimal but tolerable).\n- \"context\": the ADR documents background, rationale, or non-prescriptive description (no rule asserted; explains how/why something exists).\n\n# Reference context handling\n\nIf reference context is provided (existing architectural documentation in any format), use it as INPUT to inform ADR generation:\n\n- Where reference context describes CURRENT architectural decisions visible in the code, capture those decisions as ADRs with substantive context inheritance from the reference documentation (preserving rationale, alternatives considered, etc.). Where reference context describes superseded/withdrawn/rejected decisions (visible via `:Status:` field or similar), capture as historical context within the relevant ADR documenting CURRENT state, but do not generate them as separate authoritative ADRs.\n\n- Capture decisions implicit in the code but NOT yet documented in the reference context.\n\n- Where reference context conflicts with current code state, defer to CURRENT CODE STATE as authoritative. Reference context may be outdated; code is source of truth. When substantive conflicts surface (e.g., reference doc says \"we use X pattern\" but code clearly uses Y pattern), capture as architectural-evolution observation within the relevant ADR's Context section.\n\nIf no reference context is provided, generate ADRs from the codebase alone (pure cold-start path).\n\n# Anti-hallucination discipline\n\nAvoid hallucinating decisions not supported by code/comment evidence. If the codebase does not exhibit a clear architectural decision in some area, do NOT invent one \u2014 fewer well-grounded ADRs are better than more speculative ones.\n\nWhen you cite a line number, the line must exist in the file. When you reference a symbol, the symbol must exist. When you describe a code pattern, you must have actually read code that exhibits it.\n\n# Output discipline\n\nOutput ONLY the JSON object. No prose, no markdown fencing, no commentary outside the JSON.\n\nCodebase:\n---\n"; /** * Model string for ADR generation. Same model as extraction (Opus * 4.7) for cost-accounting consistency + because the same model * substantively produced production-grade JSON output during * EXTRACTION_PROMPT calibration (100% parse success across 12 * documents in pre-scaffolding validation per ADR-02). * * Opus 4.7 supports a 1M-token context window at standard API * pricing with no long-context premium (Anthropic docs Jan 2026). * Reference-context-aided generation can use substantial reference * inputs (~800k available after codebase + prompt + output reserves) * without falling off-budget. */ export declare const GENERATION_MODEL = "claude-opus-4-7"; /** * Maximum output tokens for a single generate-adrs call. Generous * default that accommodates 5-30 ADRs per typical-to-large codebase * without truncating. Opus 4.7 supports 128k max output tokens. */ export declare const GENERATION_MAX_TOKENS = 64000; /** * Soft-warning threshold for reference-context token count per v0.7 * Step 2.2.a.2 Lock 1 (γ user-configurable scope + soft-warning + * attempt-anyway). Emits informational warning when reference * context exceeds this size; generation proceeds regardless. Tuned * to 500k tokens (~62% of the ~800k available reference-context * budget after reserving for codebase inventory + prompt + ADR * output). Empirical calibration at Step 2.2.b.ii Rich + * \`django/deps\` verification may revise this constant. */ export declare const REFERENCE_CONTEXT_TOKEN_WARNING_THRESHOLD = 500000; /** * Opus 4.7 pricing per million tokens (USD), used for pre-flight * cost estimation in the CLI confirmation prompt. Public Anthropic * pricing as of Jan 2026. Bumping these requires updating * cost-priors-v0.6.json substrate + ADR-19 §2 pricing-model context. */ export declare const OPUS_INPUT_PRICE_PER_MILLION_USD = 5; export declare const OPUS_OUTPUT_PRICE_PER_MILLION_USD = 25; //# sourceMappingURL=prompt.d.ts.map