{"slug":"context-creation-3","title":"context-creation","summary":"The brownfield back-fill. Routed to by /create-context, and by startup when .codearbiter/CONTEXT.md lacks the <!--INITIALIZED--> body marker but source code exists. Six gated phases — pre-flight, scout dispatch, synthesis, gap interview, write, lock. Reads the existing codebase t","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-08-24T16:57:04.815176Z","repo":{"url":"https://github.com/arbiterForge/codeArbiter","stars":145,"forks":7,"license":"AGPL-3.0","updatedAt":"2026-09-27T13:54:01Z"},"bodyHtml":"<hr>\n<h2>name: context-creation\ndescription: The brownfield back-fill. Routed to by /create-context, and by startup when .codearbiter/CONTEXT.md lacks the  body marker but source code exists. Six gated phases — pre-flight, scout dispatch, synthesis, gap interview, write, lock. Reads the existing codebase through parallel scouts, drafts every surviving project-state doc, resolves gaps with the user, and locks the project as initialized.</h2>\n<h1>context-creation</h1>\n<p>Wrap an existing codebase in project state, without guessing. Routed to by <code>/create-context</code>, and by startup when <code>.codearbiter/CONTEXT.md</code> exists but carries no <code>&lt;!--INITIALIZED--&gt;</code> body marker and meaningful source code is present. When no meaningful source exists, this is the wrong skill — route to <code>decompose</code> instead.</p>\n<p>This back-fills from existing source. It complements <code>$ca-init</code>, which scaffolds an empty <code>.codearbiter/</code> for a fresh project; here the docs are derived from what is already on disk.</p>\n<h2>Pre-flight</h2>\n<p>Read these, or STOP and surface the gap — never guess project identity or a command:</p>\n<ul>\n<li><code>&lt;project-root&gt;/.codearbiter/CONTEXT.md</code> — if it already carries <code>&lt;!--INITIALIZED--&gt;</code>, context exists. Stop and route to normal operation.</li>\n<li>The repository root listing (one level deep) — the source surface this skill extracts from.</li>\n</ul>\n<p>The excluded set (not \"meaningful source\"): <code>.git/</code>, <code>.codearbiter/</code>, <code>.claude/</code>, <code>AGENTS.md</code>, <code>CLAUDE.md</code>, <code>README.md</code>, <code>LICENSE</code>, <code>.gitignore</code>, <code>.gitmodules</code>, and standard tooling dotfiles (<code>.editorconfig</code>, <code>.prettierrc</code>, etc.). Meaningful source MUST exist beyond it.</p>\n<h2>Phase 1 — Pre-flight confirmation · gate: BLOCK</h2>\n<p>Confirm the repository is a brownfield codebase safe for scout-based extraction:</p>\n<ol>\n<li>Confirm <code>&lt;!--INITIALIZED--&gt;</code> is absent from <code>CONTEXT.md</code>.</li>\n<li>Confirm meaningful source code is present beyond the excluded set.</li>\n<li>Identify the primary source directories (<code>src/</code>, <code>backend/</code>, <code>frontend/</code>, <code>lib/</code>, <code>app/</code>, or equivalent).</li>\n</ol>\n<p>State the finding to the user: existing source detected, beginning scout-based extraction.</p>\n<p>Gate: <code>&lt;!--INITIALIZED--&gt;</code> absent AND meaningful source present. If the marker is present, stop and route to normal operation. If no meaningful source exists, stop and route to <code>decompose</code>. Neither condition met → do not proceed.</p>\n<h2>Phase 2 — Scout dispatch · gate: BLOCK</h2>\n<p>A <strong>scout</strong> is a restricted, read-only role, not an unconstrained\n<code>general-purpose</code> agent. A scout reads one targeted slice of the codebase and\nreturns a structured findings report — file paths, line numbers, and named\nvalues only, never raw code excerpts. Scouts are internal to this skill; they\nare never invoked from a command.</p>\n<p>Dispatch six isolated <code>scout</code> subagents simultaneously. If the active host\ncannot provide isolated subagents, BLOCK context creation and report the host\ncapability gap. The general inline-role fallback does not apply here: this\nskill's report-only synthesis contract depends on the orchestrator never\nloading the scouts' raw source into its own context.\nEach reads only its assigned slice:</p>\n<ul>\n<li><strong>Scout A — Tech stack.</strong> Read <code>package.json</code>, lockfiles, <code>pyproject.toml</code>, <code>requirements.txt</code>, <code>go.mod</code>, <code>Cargo.toml</code>, <code>*.gemspec</code>, <code>Gemfile</code>. Report languages, runtime versions, frameworks, key dependencies, the dependency manager, license fields. Additionally report, at the repository root only: which of <code>package.json</code> / <code>pyproject.toml</code> / <code>Cargo.toml</code> / <code>composer.json</code> carry a version field (candidate release manifests), which of <code>CHANGELOG.md</code> / <code>CHANGES.md</code> / <code>HISTORY.md</code> are present (candidate changelogs), and any existing tag naming convention visible in the repo (e.g. a <code>v*</code> tag) — the inputs Phase 3/5 use to draft <code>.codearbiter/release-targets.md</code>.</li>\n<li><strong>Scout B — Infrastructure.</strong> Read CI/CD config (<code>.github/workflows/</code>, <code>.gitlab-ci.yml</code>, <code>Jenkinsfile</code>, <code>.circleci/config.yml</code>), <code>Dockerfile*</code>, <code>docker-compose*.yml</code>, <code>Makefile</code>, <code>*.tf</code>, IaC. Report CI/CD platform, build/test/lint commands, deployment targets, environment names, containerization, IaC tool.</li>\n<li><strong>Scout C — Architecture.</strong> Read the source tree (names and structure only), entry points (<code>main.ts</code>, <code>index.ts</code>, <code>app.py</code>, <code>server.go</code>), and imports in entry points only. Report component list, entry points, module boundaries, architectural pattern, public interfaces.</li>\n<li><strong>Scout D — Security posture.</strong> Read auth files (<code>auth*</code>, <code>middleware*</code>, <code>guard*</code>, <code>jwt*</code>, <code>session*</code>, <code>oauth*</code>), crypto import lines, secret-loading sites (<code>process.env</code>, <code>os.environ</code>, vault/KMS call sites — paths and line numbers only, never values), <code>.env.example</code> (never <code>.env</code>). Report auth mechanism, crypto libraries, secret-loading patterns (paths + lines, no values), vault/KMS integration, hardcoded-secret risk files (paths only).</li>\n<li><strong>Scout E — Testing.</strong> Read test files and test config (<code>vitest.config.*</code>, <code>jest.config.*</code>, <code>pytest.ini</code>, Makefile test flags), coverage config. Report test framework, runner command, coverage tool, coverage thresholds in config, naming convention, approximate test count by type, fixtures.</li>\n<li><strong>Scout F — Data model.</strong> Read migration files (<code>migrations/</code>, <code>drizzle/</code>, <code>alembic/</code>, <code>db/migrate/</code>), schema definitions (<code>schema.ts</code>, <code>*.prisma</code>, <code>*.sql</code>, <code>models/</code>), ORM config, DB connection config (keys only, never credentials). Report database type, ORM/query builder, entity names, migration tool, approximate entity count, multi-tenancy patterns.</li>\n</ul>\n<p>The orchestrator reads only the scout reports in later phases — never the raw source — to preserve working context. A scout that finds nothing returns an explicit \"not found\" report, never silence.</p>\n<p><strong>Content hashes:</strong> Scouts additionally emit a <code>git hash-object &lt;path&gt;</code> content oid per cited file in the hash field of their evidence entry. The scout already Read those files — no additional pass is needed, and no raw content is forwarded to the orchestrator.</p>\n<p>Gate: all six scout reports returned. A missing report is a blocking gap — do not proceed with an incomplete picture. Re-dispatch a failing scout before Phase 3.</p>\n<h2>Phase 3 — Synthesis · gate: BLOCK</h2>\n<p>Draft every surviving project-state doc from the six reports, working only from the reports. Map source to destination:</p>\n<table>\n<thead>\n<tr>\n<th>Scout source</th>\n<th>Destination</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>A (tech stack), B (build/test/lint commands), E (test runner)</td>\n<td><code>tech-stack.md</code></td>\n</tr>\n<tr>\n<td>C (architecture), E (structure)</td>\n<td><code>coding-standards.md</code></td>\n</tr>\n<tr>\n<td>D (security)</td>\n<td><code>security-controls.md</code> (thin)</td>\n</tr>\n<tr>\n<td>A (candidate manifest, candidate changelog, tag convention)</td>\n<td><code>.codearbiter/release-targets.md</code></td>\n</tr>\n<tr>\n<td>All scouts</td>\n<td><code>CONTEXT.md</code> (project identity, purpose, scope, NOT-building)</td>\n</tr>\n</tbody>\n</table>\n<p>Classify every finding by confidence:</p>\n<ul>\n<li><strong>HIGH</strong> — directly and unambiguously in a report (e.g., <code>\"jest\"</code> in <code>package.json</code>). Write it as fact.</li>\n<li><strong>MEDIUM</strong> — inferred from an indirect signal (directory layout implies layered architecture, no explicit config). Write it with a note: inferred from [signal], verify before relying on it.</li>\n<li><strong>LOW</strong> — no signal, or conflicting signals. Write a <code>[CONFIRM-NN]</code> placeholder.</li>\n</ul>\n<p>Every <code>[CONFIRM-NN]</code> carries: a sequential ID, one sentence on what is unknown, why it matters, and what would resolve it. IDs are sequential with <code>open-questions.md</code>.</p>\n<p><strong><code>.codearbiter/release-targets.md</code> is HIGH-confidence only when Scout A found exactly one candidate manifest and exactly one candidate changelog at the repository root.</strong> Draft the row then, in the grammar <code>${CLAUDE_PLUGIN_ROOT}/hooks/_releaselib.py</code>'s module docstring declares — a single-target project needs only <code>prefix</code>, <code>manifest</code>, <code>changelog</code>, <code>payload</code>:</p>\n<pre><code>&lt;!-- release-targets --&gt;\n[app]\nprefix: v\nmanifest: package.json\nchangelog: CHANGELOG.md\npayload: .\nlatest-eligible: true\n&lt;!-- /release-targets --&gt;\n</code></pre>\n<p>(<code>prefix</code> defaults to <code>v</code> unless Scout A found a different existing tag convention; <code>payload</code> is <code>.</code> for a single-package repository.) Zero, or more than one, candidate manifest or changelog is LOW confidence — the same \"no signal, or conflicting signals\" rule above — and gets a <code>[CONFIRM-NN]</code> instead of a guessed row; this doc is never scaffolded from an ambiguous scan, and the file is simply not written until the gap is resolved in Phase 4.</p>\n<p><strong><code>latest-eligible: true</code> is not cosmetic.</strong> <code>/release</code>'s own back-fill detector (<code>detect_candidate_target</code>) emits it for this exact single-target shape, so a project drafted here and one back-filled through <code>/release</code> must agree — omitting it here would default the row's Phase-3 publish to <code>--latest=false</code>, and the same project would get different release behavior depending on which lane happened to declare it first.</p>\n<p>Gate: every surviving doc drafted; every low-confidence inference carries a <code>[CONFIRM-NN]</code>. No silent omission. A domain with no scout signal gets a doc with a <code>[CONFIRM-NN]</code> for the whole section — never an empty file.</p>\n<h2>Phase 4 — Gap interview · gate: BLOCK</h2>\n<p>Resolve <code>[CONFIRM-NN]</code> items with the user. Ask only what the scouts could not answer with HIGH confidence.</p>\n<ol>\n<li>Present the <code>[CONFIRM-NN]</code> list grouped by category — gaps the scan could not resolve.</li>\n<li>Ask ONE targeted question per item. No compound questions. Do not re-ask anything scouts answered with HIGH confidence.</li>\n<li>Per answer: if it resolves the gap, replace the placeholder with content; if the user explicitly defers, keep the placeholder, mark it deferred with the date, and record it in <code>open-questions.md</code>; if the answer is vague, challenge it and demand a concrete answer before recording anything.</li>\n</ol>\n<p>Gate: every <code>[CONFIRM-NN]</code> has exactly one outcome — resolved (replaced with content) or explicitly deferred (marked and recorded in <code>open-questions.md</code>). No item is silently dropped. Do not proceed with unacknowledged gaps.</p>\n<h2>Phase 5 — Project-state write · gate: BLOCK</h2>\n<p>Write the surviving docs to <code>&lt;project-root&gt;/.codearbiter/</code>. Every doc carries actual content — no unresolved placeholder may remain where a value was determined:</p>\n<table>\n<thead>\n<tr>\n<th>File</th>\n<th>Content</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>CONTEXT.md</code></td>\n<td>Project identity, purpose, scope, primary users, NOT-building. Frontmatter MUST include <code>arbiter: enabled</code> (the activation flag the SessionStart hook keys on) and <code>stage:</code> set to a single maturity number (default <code>1</code>; the user may raise it if the project is further along).</td>\n</tr>\n<tr>\n<td><code>tech-stack.md</code></td>\n<td>Languages, frameworks, test runner, lint command, build command, coverage command, issue-tracker command (e.g. <code>gh issue create</code>).</td>\n</tr>\n<tr>\n<td><code>coding-standards.md</code></td>\n<td>Structural patterns, naming conventions, style rules.</td>\n</tr>\n<tr>\n<td><code>security-controls.md</code></td>\n<td>Thin: auth mechanism, banned crypto primitives, secret-loading stance. Only what a security boundary actually requires.</td>\n</tr>\n<tr>\n<td><code>open-questions.md</code></td>\n<td>Every deferred <code>[CONFIRM-NN]</code> in <code>CONFIRM-NN: &lt;description&gt;</code> form.</td>\n</tr>\n<tr>\n<td><code>open-tasks.md</code></td>\n<td>Create the file with its heading only. <strong>Every task goes in through the board helper, one call per item — <code>python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/taskwrite.py\" add \"&lt;task&gt;\"</code> — never by writing entries into the file directly</strong> (B-18). The helper owns the board schema the SessionStart hook and the statusline parse, so a backlog seeded this way cannot drift from it; and once <code>open-tasks.md</code> is enrolled in the protected-state registry, a direct write is refused outright, which would leave a Write-tool instruction here unfollowable. If scouts found no backlog, the heading-only file stands as the stub.</td>\n</tr>\n<tr>\n<td><code>overrides.log</code></td>\n<td>Empty append-only audit log, created so <code>/override</code> has a sink.</td>\n</tr>\n<tr>\n<td><code>release-targets.md</code></td>\n<td>Conditional, unlike every other row above: written ONLY when Phase 3 drafted it at HIGH confidence (exactly one candidate manifest, exactly one candidate changelog) or Phase 4 resolved its <code>[CONFIRM-NN]</code> to a concrete row. Left unwritten otherwise — <code>/release</code>'s own back-fill lane (or a later <code>context-creation</code> run, once the ambiguity resolves) is the sanctioned way to create it, never a guess made here. <strong>This file is marker-gated protected state; it needs the authoring marker below, unlike every other row in this table.</strong></td>\n</tr>\n</tbody>\n</table>\n<p><strong>Authoring marker — required for <code>release-targets.md</code> only.</strong> That path is enrolled in the protected-state registry as <code>marker-gated</code> (hook <code>H-22</code>), so a Write against it is refused unless a fresh authoring marker exists. This lane is a sanctioned author of it, so it mints one immediately before the write and removes it immediately after — the same one-pass shape <code>/release</code>'s back-fill lane uses:</p>\n<pre><code>mkdir -p \"$(git rev-parse --show-toplevel)/.codearbiter/.markers\"\ntouch \"$(git rev-parse --show-toplevel)/.codearbiter/.markers/release-targets-authoring\"\n</code></pre>\n<p>Write the file, then:</p>\n<pre><code>rm -f \"$(git rev-parse --show-toplevel)/.codearbiter/.markers/release-targets-authoring\"\n</code></pre>\n<p>Skip both commands entirely when this run is not writing <code>release-targets.md</code> — a marker minted for a write that never happens is a 30-minute window nothing needed. No other file in the table above is enrolled, so none of them take a marker.</p>\n<p>If scouts found existing decision records (<code>docs/decisions/</code>, <code>adr/</code>), summarize them as entries under <code>.codearbiter/decisions/</code> in the standard ADR format. If a record cannot be fully parsed, summarize what is known, flag the uncertainty, and note the source path for review.</p>\n<p><strong>Provenance and code-map (small addition, not a Phase 5 rebuild):</strong></p>\n<ul>\n<li>Write ONE provenance file per derived doc to <code>.codearbiter/.provenance/&lt;doc&gt;.json</code> via <code>_provenancelib.write_provenance</code> and <code>new_record</code>. Each entry carries: <code>path</code> (repo-relative), <code>hash</code> (the scout's <code>git hash-object</code> oid), <code>drift_trigger</code> (from <code>_provenancelib.classify_source(path)</code>), and the <code>claims</code> array with <code>lines</code>, <code>claim</code>, and <code>confidence</code> drawn from the scout evidence.</li>\n<li>Synthesize <code>.codearbiter/code-map.md</code> (concern → path → ≤1-line role) from Scout C (architecture) evidence. Use concern headings (<code>## &lt;concern&gt;</code>) and column-0 bullets (<code>- \\</code>path` — role`). Keep it coarse — module/concern granularity only, no full file listing.</li>\n</ul>\n<p>Do NOT scaffold any cut doc — see <code>${CLAUDE_PLUGIN_ROOT}/includes/cut-docs.md</code> for the canonical never-scaffold list. Maturity lives in the <code>stage:</code> frontmatter of <code>CONTEXT.md</code>, not a separate file.</p>\n<p>Gate: every surviving doc written; <code>CONTEXT.md</code> frontmatter carries <code>arbiter: enabled</code> and <code>stage:</code>; no resolved value left as a placeholder. Deferred <code>[CONFIRM-NN]</code> items are acceptable only in <code>open-questions.md</code>.</p>\n<h2>Phase 6 — Initialization lock · gate: BLOCK</h2>\n<p>Lock the project state as initialized and return to normal orchestration:</p>\n<ol>\n<li>Write the <code>&lt;!--INITIALIZED--&gt;</code> marker into the body of <code>CONTEXT.md</code>.</li>\n<li>List <code>.codearbiter/</code> and display the populated tree.</li>\n<li>Confirm each required file is present and non-empty: <code>CONTEXT.md</code> (with <code>arbiter: enabled</code> frontmatter and the <code>&lt;!--INITIALIZED--&gt;</code> body marker), <code>tech-stack.md</code>, <code>coding-standards.md</code>, <code>security-controls.md</code>, <code>open-questions.md</code>, <code>open-tasks.md</code>, <code>overrides.log</code>.</li>\n<li>State the return to normal operation: extraction complete, project state initialized and locked, <code>$ca-feature</code> available to begin work. Deferred questions live in <code>open-questions.md</code>.</li>\n</ol>\n<p>Gate: <code>arbiter: enabled</code> set and <code>&lt;!--INITIALIZED--&gt;</code> present in <code>CONTEXT.md</code>; every required file present and non-empty. Do not close this skill without confirming both markers are written.</p>\n<h2>Hard rules</h2>\n<ul>\n<li>MUST NOT write <code>&lt;!--INITIALIZED--&gt;</code> while any <code>[CONFIRM-NN]</code> is unaddressed — every gap must be resolved or explicitly deferred to <code>open-questions.md</code> first.</li>\n<li>MUST NOT resolve a <code>[CONFIRM-NN]</code> by guessing — surface the question to the user or defer it.</li>\n<li>MUST NOT proceed past Phase 2 with fewer than six scout reports.</li>\n<li>MUST NOT run Phase 2 inline — isolated scout subagents are required for the report-only synthesis boundary.</li>\n<li>MUST NOT load raw source into the orchestrator context after Phase 1 — synthesize from scout reports only.</li>\n<li>MUST NOT record a scout finding that exposes a secret value — paths and line numbers only.</li>\n<li>MUST NOT scaffold a cut doc — see <code>${CLAUDE_PLUGIN_ROOT}/includes/cut-docs.md</code> for the canonical never-scaffold list. Maturity is the <code>stage:</code> frontmatter number in <code>CONTEXT.md</code>.</li>\n<li>MUST NOT run when <code>CONTEXT.md</code> already carries <code>&lt;!--INITIALIZED--&gt;</code> — stop and route to normal operation.</li>\n</ul>\n","files":[{"path":"SKILL.md","sizeBytes":16401,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"notes-only","suspicious":0,"notes":4,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-27T19:35:06.417176Z","sha256":"734355F872DDF6261666F129E32444FDA8742C9DFE9544E3BE94AC696A4F4D51","sizeBytes":6599},"review":null,"source":{"repositoryUrl":"https://github.com/arbiterForge/codeArbiter","path":"plugins/ca-codex/routines/context-creation","license":"AGPL-3.0","commit":"8e88bce938ebf7dc8cfd934307b8d6859092d86e","subtreeSha":"F2B9D0964D1EDFE262B9A508BCA3003CC10D49EB91789DDE6178441B37B5542C","lastSyncedAt":"2026-09-27T19:33:31.953812Z"},"reviewedAt":"2026-09-27T19:37:50.562225Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/arbiterForge/codeArbiter/tree/main/plugins/ca-codex/routines/context-creation"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install arbiterforge-codearbiter@llmmart"},{"target":"git","command":"git clone https://github.com/arbiterForge/codeArbiter.git"}]}