From 5173ce77ddbfd9d9cc3e59031b0041ad96f06444 Mon Sep 17 00:00:00 2001 From: BillyOutlast <172061051+BillyOutlast@users.noreply.github.com> Date: Fri, 4 Dec 2026 17:22:17 +0000 Subject: [PATCH] chore(org-sync): propagate Heretek-AI/.github@f27b1cc standards Signed-off-by: BillyOutlast <172061051+BillyOutlast@users.noreply.github.com> --- .../skills/adversarial-audit-prompt/SKILL.md | 255 ++++++++++++++++++ .agents/skills/security-review/SKILL.md | 2 +- .agents/skills/spoonfeeder/SKILL.md | 131 +++++++++ .github/workflows/code-quality.yml | 2 +- .github/workflows/dead-code-and-deps.yml | 2 +- .github/workflows/hygiene.yml | 2 +- .github/workflows/ocr.yml | 2 +- 7 files changed, 391 insertions(+), 5 deletions(-) create mode 100644 .agents/skills/adversarial-audit-prompt/SKILL.md create mode 100644 .agents/skills/spoonfeeder/SKILL.md diff --git a/.agents/skills/adversarial-audit-prompt/SKILL.md b/.agents/skills/adversarial-audit-prompt/SKILL.md new file mode 100644 index 0000000..a71eced --- /dev/null +++ b/.agents/skills/adversarial-audit-prompt/SKILL.md @@ -0,0 +1,255 @@ +--- +name: adversarial-audit-prompt +description: "Write a repeatable three-subagent adversarial audit prompt (PROMPT_ADVERSARIAL_FLEET_AUDIT.md) for a repository, grounded in what it is supposed to be and what it actually contains." +license: MIT +compatibility: opencode claude codex copilot +metadata: + audience: maintainers-and-agents + workflow: adversarial-audit + opencode/slash: "true" +--- + +# Adversarial audit prompt builder + +Produces one `PROMPT_ADVERSARIAL_FLEET_AUDIT.md` per repository. The user runs it later in that repo with: + +> Read PROMPT_ADVERSARIAL_FLEET_AUDIT.md and execute the three-subagent adversarial audit as instructed. Write findings to AUDIT_REPORT_FINDINGS.md. + +The prompt sends three adversarial subagents after a numbered claim inventory: + +- **Alpha:** runtime and integration. +- **Beta:** architecture, versions and supply chain. +- **Gamma:** security and abuse. + +They must prove every claim against the real systems the repo plugs into, never against its own tests. The prompt can be re-run, and each run re-checks the previous report. + +## Why it is shaped this way + +Repos built by agents from self-contained specs often pass every gate they were given while failing against reality. Typical cases: + +- tests that drive a hand-written mock host; +- invented image tags or API names copied faithfully from the spec; +- a verifier whose tests only check that rule names appear in the file. + +So the prompt's core moves are: + +- Name the real thing for each component: real host, real binary, real registry, real client. +- Treat the paper trail (reports, VERDICT: PASS, README) as claims under audit, not evidence. +- Sabotage each critical invariant to prove the tests guard it. + +## Procedure + +1. **Establish intent.** Collect what the repo is *supposed to be* from every source available: the user's blueprint or build prompt, `README.md`, `AGENTS.md` (refusal boundaries, scope), `docs/prompts/SPEC.md` or `MASTER_BUILD_PROMPT.md`, and any prior assessment or audit. Write one dense "What it is supposed to be" paragraph. It covers the job, how other components consume the repo, the refusal boundary, and the size budget if one exists. +2. **Survey reality.** Clone the current default branch. Read `git ls-files`, `package.json` or other manifests, `Makefile`, CI workflows, the README in full, and the files behind each major feature. Record every concrete, checkable fact: + - pinned versions (deps, images, actions, runtimes, upstream commits); + - flags and env vars; + - routes, events, protocol versions, file formats, ports; + - security invariants; + - cross-repo contracts (shared key formats, role names, routes, config keys). + + Write suspicious spots down as audit questions, not conclusions. Examples: a script pointing at a missing file, a floating `latest`, a fake server in test fixtures that mirrors an upstream API. +3. **Find the history of test lies.** From prior assessments, memory, PRs or the user, list concrete cases where tests or reports passed while reality failed. These go into the Cardinal Rule section verbatim. If there is no such history, name the specific mocks or fixtures the test suite depends on. +4. **Name the real things.** For each integration, name exactly what to test against. Examples: + - the upstream repo, branch and package; + - a release binary and its validate command; + - a registry API; + - an independent protocol client (MCP Inspector CLI, SDK client); + - a browser; + - an installed tarball run under the other runtime. +5. **Write the three role sections.** Each gets one Focus question and 4 to 6 methodology bullets specific to this repo: file paths, upstream files to compare, attack inputs to craft. Typical split: + - **Alpha:** load or run against the real host, at the pinned version and at upstream head (drift); extend shallow real-host tests to every feature; install as a user would. + - **Beta:** registry truth (version, tag, dist-tag, published tarball vs build), deprecations and EOL, deps in the wrong place, protocol and spec currency, scope and LOC against the refusal boundary, cross-repo fit. + - **Gamma:** bypass corpora for every guard or verifier, trust-root attacks (who can approve or sign), injection into paths, branches and commands, path containment, secrets in logs, CI supply chain (unpinned actions, floating installs in jobs with `id-token: write`). +6. **Write the claim inventory.** Group claims into domains of 2 to 7 claims each, numbered `Claim D.N`. + - Each claim is one checkable statement that quotes the repo's own numbers and names. + - Tag the owner `[A]`, `[B]` or `[G]`. Tag `[S]` on every invariant whose sabotage must be caught. + - Always include a packaging/release domain and a scope/CI/ecosystem-fit domain. + - Aim for 25 to 45 claims. +7. **Write reality-check recipes.** Write a bash block of commands runnable from the repo root, using `$AUDIT_TMP` for all scratch. + - Derive versions from repo files (`rg -o …`) rather than hardcoding them where possible. + - Include one command that proves the checking method works on a known-bad input (for example, a tag that must 404). + - End with a "Sabotage targets" line that lists the `[S]` invariants as concrete code locations. +8. **Assemble.** Fill the template below. + - Set `PREFIX` to a short ID prefix for the repo (e.g. `OH`, `ACP`) and give an example finding ID. + - `P0_EXAMPLES` names what "doesn't work against the real thing" means for this repo. + - Keep paths repo-relative: the prompt resolves the root with `git rev-parse --show-toplevel`. + - If the Heretek "Rebuild" project folder is available, `/mnt/project-files/audit-prompts//PROMPT_ADVERSARIAL_FLEET_AUDIT.md` holds five worked examples. +9. **Check.** + - No `{{` is left. + - Every claim has an owner. + - Every `[S]` claim appears among the sabotage targets. + - Recipes reference only files that exist. + - No real secrets appear anywhere. + - Hard limits fit the repo: where running the system could touch real state, add limits such as "throwaway repo only" or "loopback ports only, `compose down -v` after". +10. **Deliver.** Name each file exactly `PROMPT_ADVERSARIAL_FLEET_AUDIT.md` and put it in a per-repo folder (default: next to the user's other outputs, e.g. `audit-prompts//`), unless the user asks for a PR into the repo. Tell the user to copy it into the repo root, and say that you have not run it. + +When doing several repos, keep the shared head and tail identical across them so reports are comparable. Only the placeholders and the body (section 2 roles, section 3 claims, section 4 recipes) differ. + +## Template + +Placeholders (fill all of them): + +- `{{REPO}}` +- `{{REMOTE}}`: the repo URL. +- `{{PURPOSE}}` +- `{{TEST_CMDS}}`: for example `bun test` or `make accept`. +- `{{SPEC_ORIGIN}}`: one sentence on where the spec came from, for example "The repo was built by agents from `MASTER_BUILD_PROMPT.md`." or "Specs and design docs were written before the code." +- `{{TOOLS}}` +- `{{NETWORK_EXTRA}}`: starts with ", "; package registries and similar hosts. +- `{{HOST_PROBES}}` +- `{{EXTRA_LIMITS}}`: starts with ", ", or empty. +- `{{TEST_LIES}}`: indented ` - ` bullets. +- `{{REAL_THINGS}}` +- `{{EXEC_EXTRA}}`: starts with ", "; the ecosystem tools, for example `, bun, npm view, npm pack`. +- `{{PREFIX}}` +- `{{EXAMPLE_ID}}` +- `{{P0_EXAMPLES}}` + +Where the template is marked, insert the repo-specific body: the three `### Subagent …` sections, `---`, `## 3. Comprehensive Inventory …`, and `## 4. Reality-Check Recipes`. + +~~~~markdown +# ADVERSARIAL THREE-SUBAGENT AUDIT PROMPT: `{{REPO}}` + +**Target Codebase**: the Git repository this file sits in. Resolve it with `git rev-parse --show-toplevel` and treat every path below as relative to that root. Nothing in this prompt depends on where the checkout lives. +**GitHub Remote**: `{{REMOTE}}` +**What it is supposed to be**: {{PURPOSE}} +**Execution Context**: OpenCode v2 autonomous audit (works the same in any agent CLI that has subagents and a shell) +**Auditor Formation**: three independent adversarial subagents (Alpha, Beta, Gamma), a cross-examination pass, and a synthesis pass +**Output**: `AUDIT_REPORT_FINDINGS.md` at the repository root + +This prompt is designed to be re-run. Each run audits the current `HEAD`, re-verifies every finding of the previous run, and overwrites `AUDIT_REPORT_FINDINGS.md`. + +--- + +## 0. Preflight (the controller does this before spawning subagents) + +1. **Baseline.** Record at the top of the report: `git rev-parse HEAD`, `git log -1 --format='%ci %s'`, the UTC date, and the versions of every tool you will use ({{TOOLS}}). If `git status --porcelain` shows changes other than this prompt file and a previous report, list the dirty files and audit a clean `git worktree` of `HEAD` instead of the working tree. +2. **Scratch space.** `export AUDIT_TMP="$(mktemp -d -t {{REPO}}-audit-XXXXXX)"`. Every clone, downloaded binary, packed tarball, sabotage copy, container volume and raw log goes under `$AUDIT_TMP`. Each subagent writes its raw notes to `$AUDIT_TMP/{alpha,beta,gamma}.md`. +3. **Disposable copy for experiments.** `git worktree add --detach "$AUDIT_TMP/wt" HEAD`. Sabotage, patched configs, and any file edits happen only there. The real checkout must end the audit with `git status --porcelain` showing nothing new but `AUDIT_REPORT_FINDINGS.md` (and this prompt file, if you copied it in untracked). Remove the copy with `git worktree remove --force "$AUDIT_TMP/wt"` at the end. +4. **Previous run.** If `AUDIT_REPORT_FINDINGS.md` already exists, read it before anything else. Every finding in it gets a row in the Regression Ledger (section 6), re-verified from scratch: never copy a previous verdict forward. +5. **Network and host capabilities.** You need outbound HTTPS to github.com, raw.githubusercontent.com{{NETWORK_EXTRA}}. Probe what this host can do ({{HOST_PROBES}}) and record it. When a check cannot run here, the claim is `UNVERIFIABLE` with the exact reason. A claim is never `VERIFIED` by inference, by reading the code alone, or because a test says so. + +**Hard limits (all subagents):** no package publishing, no `git push`, no tags, no GitHub writes (issues, comments, PRs), no real API keys or credentials in any command, file or report (generate throwaway keys and dummy values), no destructive command outside `$AUDIT_TMP`{{EXTRA_LIMITS}}. Read-only against the real checkout. + +--- + +## 1. Directive & Rules of Engagement + +You are a team of **three elite, adversarial principal systems auditors**. Your mandate is to stress-test, debunk, and verify every claimed feature, architectural decision, integration contract, security invariant, and version pin in **`{{REPO}}`**, measured against what the repository is supposed to be (above) and what its own `README.md`, `AGENTS.md` and `docs/` claim. + +### The Cardinal Rule: DO NOT BELIEVE TESTS +- Unit tests, acceptance scripts and CI badges can lie: they assert obsolete invariants, mock away the real system, or test that a file *contains* a rule rather than that the rule *works*. +- This repository has a documented history of exactly that: +{{TEST_LIES}} +- Never conclude that a component works because `{{TEST_CMDS}}` exits 0. Prove behavior against **the real thing it plugs into**: {{REAL_THINGS}}. + +### The Second Rule: DO NOT BELIEVE THE PAPER TRAIL +- `docs/reports/*`, `docs/evidence/*`, "red-proof" logs, drift-guard `VERDICT: PASS` lines, `CHANGELOG.md`, and `README.md` are **claims under audit**, not evidence. +- {{SPEC_ORIGIN}} Build gates that only check spec compliance cannot catch invented facts (API names, image tags, config shapes) in the spec. Matching the spec is not the same as working. Where the spec and reality disagree, reality wins and the spec is the defect. + +### The Third Rule: SABOTAGE EVERY CRITICAL INVARIANT +- For each invariant marked **[S]** in section 3, break it with a one-line change in `$AUDIT_TMP/wt`, run the full suite there, and record whether the suite went red. Restore the line after each run. +- A sabotage the suite does not catch is a finding: **P1** ("untested invariant"), or **P0** when the invariant is a security boundary. + +### Modern Version & Proper Deployment Imperative +- Every pinned version must be a **modern, supported, production-grade release that actually exists** in its registry. Flag invented versions, deprecated or archived packages, renamed organizations, floating tags (`latest`, `^` ranges on security-relevant deps, unpinned GitHub Actions), end-of-life runtimes, and versions with known CVEs (the ecosystem's audit tool, OSV: `https://api.osv.dev/v1/query`). +- Verify that integration patterns follow the **official upstream documentation and source code** of the system being integrated, at the version pinned and at the current upstream head (drift is a finding). + +### Verdict vocabulary +Every claim in section 3 ends with exactly one status, each backed by a command and its output: +- `VERIFIED` (proven to work against the real thing), `PARTIAL` (works with caveats you name), `BROKEN` (proven not to work), `UNVERIFIABLE` (could not be run here, with the exact reason). + +--- + +## 2. The Adversarial Triad (Subagent Roles) + +```mermaid +graph TD + C["OpenCode Controller"] --> A["Alpha: Runtime & Integration Inquisitor"] + C --> B["Beta: Architecture, Versions & Supply Chain"] + C --> G["Gamma: Security, Trust Boundaries & Abuse"] + A --> X["Cross-examination: each finding attacked by a different subagent"] + B --> X + G --> X + X --> S["Synthesis: AUDIT_REPORT_FINDINGS.md"] +``` + + + +--- + +## 5. Execution Directives for OpenCode + +1. **Independent exploration.** Spawn Alpha, Beta and Gamma concurrently as three separate subagents. Hand each one this entire file plus its role. They must not read each other's notes until step 4. Each one works through the claims it owns (ownership is marked `[A]`, `[B]`, `[G]` in section 3) and may file findings on any claim. +2. **Run things.** Prefer executing to reading. Use the recipes in section 4 and any further commands you need (`git ls-remote`, `curl`, `jq`, `rg`{{EXEC_EXTRA}}). Save the raw output of every command you cite under `$AUDIT_TMP/logs/`. +3. **Empirical Proof Mandate.** For every claim judged `BROKEN`, `PARTIAL`, insecure, or outdated, record: + - the exact file path and line number (`path/to/file.ts:123`); + - the exact command executed to prove it, runnable as written from the repository root; + - the raw output, error message, or registry response (trimmed to the relevant lines, never paraphrased); + - for upstream comparisons, the upstream file path and commit SHA you compared against. +4. **Cross-examination.** When all three are done, each finding is handed to a different subagent (Alpha's to Beta, Beta's to Gamma, Gamma's to Alpha), whose job is to refute it: re-run the proof, look for a misreading, a wrong upstream version, or an environment artifact. A refuted finding is dropped or downgraded, and the refutation is noted in the finding. +5. **Coverage gate.** Before synthesis, check that every claim ID in section 3 has a status. Any claim without one goes back to its owner. +6. **Synthesis.** The controller writes `AUDIT_REPORT_FINDINGS.md` in the structure below, then cleans up (`git worktree remove`, stop any containers or processes you started) and confirms the real checkout has no changes apart from the report and this prompt file. + +--- + +## 6. Report Structure: `AUDIT_REPORT_FINDINGS.md` + +```markdown +# AUDIT_REPORT_FINDINGS: {{REPO}} + +## Baseline +Commit, commit date, audit date (UTC), tool versions, host capabilities, and the list of checks that could not run here and why. + +## Verdict +Three to six sentences: does `{{REPO}}` do what it is supposed to be, against the real systems it plugs into? Name the single most important thing to fix. + +## Prioritized Defect Matrix +| ID | Priority | Claim | Location | Summary | +|----|----------|-------|----------|---------| + +## Findings +### {{PREFIX}}--: +- **Priority:** P0 | P1 | P2 | P3 +- **Claim:** <claim ID and text> +- **Location:** `path:line` +- **Proof:** the command(s), runnable from the repo root +- **Raw output:** fenced block, trimmed, verbatim +- **Why it matters:** one or two sentences, in terms of what breaks for a user +- **Remediation:** an exact, fail-closed diff or command sequence +- **Verify the fix:** the command that goes from failing to passing once fixed +- **Cross-examination:** who challenged it and what they found + +## Claim Ledger +| Claim | Status | Evidence (command or finding ID) | +Every claim ID from section 3, no omissions. + +## Sabotage Results +| Invariant | One-line sabotage (file:line, before -> after) | Suite result | Caught? | + +## Regression Ledger +| Previous finding ID | Previous priority | Status now: FIXED / STILL OPEN / REGRESSED / NO LONGER APPLICABLE | Evidence | +(Write "First run" if there was no previous report.) + +## Not Audited / Unverifiable +What could not be checked, why, and what a human needs to provide to check it. +``` + +**Finding IDs are stable across runs.** Use `{{PREFIX}}-<claim-id>-<short-slug>` (for example `{{PREFIX}}-{{EXAMPLE_ID}}`) so the next run's Regression Ledger can match findings by ID. + +**Priority definitions:** +- **P0 / Critical:** the component does not work against its real host or upstream ({{P0_EXAMPLES}}); a security boundary can be bypassed; a pinned artifact does not exist; a release on a registry is broken. +- **P1 / High:** deprecated or end-of-life versions, fail-open error handling, an untested security or correctness invariant (sabotage survived), an integration contract that drifted from the current upstream head, severe scope or architecture drift from what the repo is supposed to be. +- **P2 / Medium:** non-fatal version lag, documentation that contradicts behavior, missing CI coverage for a reality check, suboptimal resource or performance choices. +- **P3 / Low:** style, dead code, naming, minor cleanups. + +For every finding, provide the exact, fail-closed code diff or command sequence to remediate. Do not apply it to the real checkout. +~~~~ + +## Example claim lines + +```markdown +* **Claim 2.1 [A][S]**: All 14 direct tools register in the real host because their `input` is plain JSON Schema, and each executes successfully through the host. +* **Claim 6.1 [G][S]**: The server computes `subjectHash` from the diff itself; no client-supplied hash, public key or passphrase is trusted. +* **Claim 2.1 [A][B]**: Every published image pin exists in its registry. +``` \ No newline at end of file diff --git a/.agents/skills/security-review/SKILL.md b/.agents/skills/security-review/SKILL.md index 0805f2c..a18bf0b 100644 --- a/.agents/skills/security-review/SKILL.md +++ b/.agents/skills/security-review/SKILL.md @@ -28,7 +28,7 @@ Conducts a disciplined, evidence-backed security review modeled on a threat-mode 2. **Run fast deterministic checks first (if available locally).** - Secrets & hygiene — pick the scanner mode that matches what you are reviewing: - Pre-commit or staged-change check: `gitleaks protect --staged --redact --no-banner` - - PR branch or repository review (scans commits in range, not just the index): `gitleaks detect --source . --log-opts="--diff-merges=separate $(git merge-base origin/main HEAD)..HEAD" --redact --no-banner`. Substitute the real upstream base ref (for example `origin/trunk`) and omit `--log-opts` only when you intend to scan the entire history. `--no-git` (directory mode) remains available for non-git artifacts such as release tarballs. + - PR branch or repository review (scans commits in range, not just the index): `gitleaks detect --source . --log-opts="$(git merge-base origin/main HEAD)..HEAD" --redact --no-banner`. Substitute the real upstream base ref (for example `origin/trunk`) and omit `--log-opts` only when you intend to scan the entire history. `--no-git` (directory mode) remains available for non-git artifacts such as release tarballs. - Both `protect --staged` and `detect --log-opts` are current `gitleaks` v8 flags (verified against 8.30.1). `--redact` already defaults to 100% but pass it explicitly so a future default change cannot leak secret material into the review log. - Dependencies & IaC: `trivy fs --scanners vuln,misconfig,secret --severity HIGH,CRITICAL .` - GitHub Actions: `actionlint` and `uvx zizmor@1.33.1 --format=plain .` diff --git a/.agents/skills/spoonfeeder/SKILL.md b/.agents/skills/spoonfeeder/SKILL.md new file mode 100644 index 0000000..8eb5fea --- /dev/null +++ b/.agents/skills/spoonfeeder/SKILL.md @@ -0,0 +1,131 @@ +--- +name: spoonfeeder +description: "Spec a whole build, verify the risky facts by running them, then write an exhaustive milestone-by-milestone prompt a weaker coding agent can follow without guessing." +license: MIT +compatibility: opencode claude codex copilot +metadata: + audience: maintainers-and-agents + workflow: spec-and-handoff + opencode/slash: "true" +--- + +# Spoonfeeder + +You are the smart agent. Your job is to do all of the thinking, so that a cheaper or weaker coding agent can do all of the typing. The deliverable is one markdown brief. It must be so complete and so verified that the coding agent never has to guess, never has to rely on its own memory of an API, and always knows when a step is done. + +The core rule: **every fact the coding agent depends on must be verified by you, by running it, before it goes in the brief.** Weaker agents fail mostly by trusting stale training data, not by writing bad code. Any fact you haven't checked is a trap you are setting for them. + +## When to use + +Use this skill when the user wants a plan and a prompt for another agent to implement, for example "spec this out and write a prompt for my local agent" or "spoonfeed this to a dumber model". Do not use it when you are going to write the code yourself. + +## Workflow + +Do these phases in order. Skip a phase only when its output already exists. For example, if a spec is already agreed, start at phase 3. + +### Phase 1: Ground truth + +1. Read everything the user pointed at: repos, prior art, other models' proposals. +2. **Fact-check every claim you were handed**: CLI flags, API names, version numbers, counts. Check them against the installed tool, its `--help`, its type definitions or its source, never against memory or docs websites, which often describe an older major version. + - Install the exact pinned version if you can (`npm i <pkg>@<ver>`, `pip install`, and so on). + - Run `--help`. Read the `.d.ts` files or the source. `strings` the binary for env vars and hidden flags if you need to. +3. Produce a short verdict table: claim, verdict, evidence (a command and its output, or `file:line`). + +### Phase 2: Design (grilling) + +Work the design tree with the user one round at a time. + +- Ask 1 to 3 questions per round. Phrase each so that "yes" accepts your recommendation, and give one line per option. +- Give your take on any questions the user or another model already asked. Agree, disagree, or amend, and give a reason for each. +- If the user delegates ("I trust your judgement"), stop asking. Decide the rest yourself and record each decision with its reason. +- Write the agreed design as a spec file: goal, non-goals, architecture, config and schemas, execution details, packaging, a validation plan, the implementation order, and a decisions log. Put the spec in the target repo and open a PR if there is one. + +### Phase 3: Spike the unknowns (do not skip) + +List every assumption the implementation depends on that you have not yet seen work. Typical ones: + +- how a plugin or module is discovered and loaded, +- the order in which things execute, +- exact payload and return shapes, +- event and log formats, +- naming ("is the tool called `bash` or `shell`?"), +- error behavior, +- env vars that change behavior. + +Then, for each one: + +1. Write the smallest throwaway experiment that answers it. Put it in a scratch directory, never the repo. +2. Run it against the real pinned version and capture the actual output. +3. Write the answer down as a fact with its evidence. +4. If a result contradicts the spec, fix the spec now, in a PR, and say what changed. + +Also run any code you plan to give the coding agent as a reference implementation, exactly as it will appear in the brief. If it has a bug, fix it in the brief and re-run it. A reference implementation you haven't run is a guess. + +Watch especially for silent failures: things that are skipped or ignored with no error or log line. Those are the ones a weak agent will never debug on its own. + +### Phase 4: Write the brief + +Write one markdown file, usually `docs/IMPLEMENTATION_PROMPT.md` in the target repo. It must contain these sections, in this order: + +1. **Mission.** Two sentences on what is being built. Tell the agent to read the whole file before writing code, and that its training data is out of date for this project. +2. **How to work.** Numbered rules: + - milestones in order, + - an acceptance check must pass before moving on, + - commit per milestone with explicit staging, + - never skip, delete or weaken tests, + - never invent APIs; look them up in a named order (types, source, an experiment), + - log every discovery and discrepancy in `docs/NOTES.md` with evidence, + - stop after 3 failed attempts on the same error and write down what was tried, + - any hard "never do X" rules the spike uncovered. +3. **Paths and setup.** + - The exact absolute paths on the user's machine, as the user gave them. + - The branch to create. + - Where to clone reference repos (a git-ignored scratch dir). + - Exact install commands for the pinned toolchain, with the expected `--version` output. + - A table of files to port from reference repos and what to take from each. + - License obligations for anything ported. +4. **Verified facts.** Everything from phases 1 and 3, grouped by topic: + - exact command lines, + - exact config shapes, + - exact payload types (as code blocks), + - real captured output samples (log lines, events, error messages) the agent can use as test fixtures, + - the surprises, called out loudly. + + End this section with a subsection **"Not verified, be careful"** listing what you could not confirm, and tell the agent to check those items early and record the answers. +5. **Target layout.** The full file tree, with a one-line purpose comment for every file. Include `package.json` (or equivalent) verbatim, plus the tsconfig, linter and test-runner setup. +6. **Milestones.** Usually 8 to 15. Each one has: + - **Do:** the exact files, function signatures as code, the algorithm in numbered steps, and the edge cases. + - **Acceptance:** concrete commands and the expected results ("`X` prints `Y`", "this test with these inputs returns these outputs"). + + Put an early milestone that has the agent **re-run the key spike itself**, so it learns how the system behaves before building on it. Give fixtures and test data verbatim where you captured them. The final milestone is a pass that checks every spec statement against the code and opens a PR with a fixed body format. +7. **Gotchas.** A numbered list of every trap you found, each one line, to be re-read before every milestone. +8. **Definition of done.** A checkbox list. + +Writing rules for the brief: + +- **Be explicit to the point of redundancy.** Say "exactly", give literal strings, give default values in brackets, and name the error message text you expect. +- **Prefer code over prose** for interfaces, configs and algorithms. +- **Remove choices.** Pick the library, the layout and the names. A weaker agent given a choice will pick wrong or stall. +- **Every acceptance check must be runnable** and binary (pass or fail), never "looks good". +- **Security defaults go in the text**: secret redaction, no shell interpolation of untrusted input, and what must never be run with real credentials. +- **Don't pad.** Long is fine. Filler isn't. Every line should prevent a specific mistake. + +### Phase 5: Verify and deliver + +1. Re-read the brief adversarially, as the weaker agent would: where could it guess? Where could it misread a step? Fix those places. +2. Re-run any embedded reference code from the brief file itself (extract it and run it), not from your scratch copy. +3. Commit the brief to the target repo in a PR, and also attach the file to your reply so the user can hand it over directly. +4. Tell the user, in a few lines: + - the one-line instruction to give the coding agent (for example "Read docs/IMPLEMENTATION_PROMPT.md fully, then do it milestone by milestone."), + - the 2 or 3 biggest surprises the spike found, + - anything you could not verify. +5. If a PR merges before your last commit lands, check what actually reached the default branch and open a follow-up PR for anything missing. + +## Anti-patterns + +- Writing the brief from memory or docs before running anything. +- "Use an appropriate library" or "handle errors sensibly". Name the library and give the error handling. +- Acceptance checks like "tests pass" with no named tests. +- Leaving open design questions inside the brief. Decide them, or list them under "Not verified" with what to do. +- Reference code you never executed. +- Telling the agent to use tools or paths on your machine instead of theirs. diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 0978b64..3ed1501 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -20,6 +20,6 @@ permissions: jobs: code-quality: - uses: Heretek-AI/.github/.github/workflows/code-quality.yml@607db4d7eefb2b328c92f4a1b99121be848bc81c # main + uses: Heretek-AI/.github/.github/workflows/code-quality.yml@f27b1cc01ec712c15e73e14e363457dcddd1f524 # main with: blocking: false diff --git a/.github/workflows/dead-code-and-deps.yml b/.github/workflows/dead-code-and-deps.yml index 66fbc4d..1a08568 100644 --- a/.github/workflows/dead-code-and-deps.yml +++ b/.github/workflows/dead-code-and-deps.yml @@ -27,7 +27,7 @@ permissions: jobs: dead-code-and-deps: - uses: Heretek-AI/.github/.github/workflows/dead-code-and-deps.yml@607db4d7eefb2b328c92f4a1b99121be848bc81c # main + uses: Heretek-AI/.github/.github/workflows/dead-code-and-deps.yml@f27b1cc01ec712c15e73e14e363457dcddd1f524 # main with: stack: auto upload_sarif: true diff --git a/.github/workflows/hygiene.yml b/.github/workflows/hygiene.yml index 9b89aa5..ae11c5f 100644 --- a/.github/workflows/hygiene.yml +++ b/.github/workflows/hygiene.yml @@ -10,6 +10,6 @@ permissions: jobs: hygiene: - uses: Heretek-AI/.github/.github/workflows/hygiene.yml@607db4d7eefb2b328c92f4a1b99121be848bc81c # main + uses: Heretek-AI/.github/.github/workflows/hygiene.yml@f27b1cc01ec712c15e73e14e363457dcddd1f524 # main with: audit_workflows: true diff --git a/.github/workflows/ocr.yml b/.github/workflows/ocr.yml index dfac193..4e63e04 100644 --- a/.github/workflows/ocr.yml +++ b/.github/workflows/ocr.yml @@ -37,6 +37,6 @@ permissions: jobs: review: - uses: Heretek-AI/.github/.github/workflows/ocr-review.yml@607db4d7eefb2b328c92f4a1b99121be848bc81c # main + uses: Heretek-AI/.github/.github/workflows/ocr-review.yml@f27b1cc01ec712c15e73e14e363457dcddd1f524 # main secrets: OCR_LLM_TOKEN: ${{ secrets.OCR_LLM_TOKEN }}