返回目录
开发工具 插件

beforedone

rrrrrredy/beforedone

Require fresh, file-bound verification evidence before coding agents declare completion.

Stars
2
Forks
0
Issues
2
更新
18 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:rrrrrredy/beforedone

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

BeforeDone

Know whether your checks still match your code.

BeforeDone runs your existing verification commands and records which files they checked. Before a coding agent finishes, it checks whether those results still apply to the current work. Start with the CLI; add an agent integration when you want the completion check to run automatically. Incident reports and replay are available for investigating a failed run.

It is most useful when a task continues after verification or when you want to reuse a previous result without rerunning an expensive check. If your normal test and CI workflow already makes this clear, the extra tool may add little. BeforeDone tracks configured verification; choosing checks that cover the task remains part of development.

Website and guide

Requirements

  • A Git repository. BeforeDone resolves its local runtime through Git.
  • A filesystem that supports same-directory hard links for the Git directory; on Windows, keep the repository on NTFS rather than FAT/exFAT removable media.
  • The verifier programs named in .beforedone.yaml, such as go, npm, or pytest.
  • Codex only if you use the Plugin, standalone Skills, or project-local hooks.
  • DeepSeek Harness 0.1.0-rc.6 and Node.js 22.19+ or 24+ only if you use the dsh-beforedone community Bundle.
  • A current Pi release exposing agent_settled, pi.exec, pi.appendEntry, and pi.sendUserMessage only if you use the Pi integration.

1. Install the CLI

With Go installed:

go install github.com/rrrrrredy/beforedone/cmd/beforedone@latest
beforedone version

Alternatively, download the archive for Windows, macOS, or Linux from GitHub Releases, verify it against checksums.txt, and put the beforedone executable on PATH.

To install a reproducible version with Go, replace @latest with a release tag, for example @v1.2.0.

2. Initialize a repository

With BeforeDone v1.2.0 or newer, connect an existing project command from the target Git repository. For a Python project, for example:

beforedone init --files "src/**/*.py" --files "tests/**/*" --files "pyproject.toml" -- python -m pytest
beforedone doctor

Older CLIs do not accept these initialization options. Upgrade to v1.2.0 or newer; existing configurations and historical receipts are preserved.

Everything after -- is saved as the argv of the test check; initialization does not run it. Put BeforeDone options, including --json, before --. Repeat --files for the inputs your command uses. Without --files, a custom command uses **/*; narrow that scope if it includes generated output or installed dependencies. Paths and commands are relative to the repository root.

init creates .beforedone.yaml and local runtime data under .git/beforedone. With no existing configuration, bare beforedone init uses go test ./... for a Go module. Other projects must supply a verifier; otherwise it exits with configuration error code 64 and writes no configuration. It can be rerun without replacing a valid configuration. If a configuration already exists, edit it to change the command or file scope; initialization options do not overwrite it.

Review the generated configuration before running checks. Commands are argv arrays, not shell command strings:

schema_version: 1
checks:
  test:
    argv: ["go", "test", "./..."]
    relevant_files: ["**/*.go", "go.mod", "go.sum"]
    working_directory: "."
    timeout_seconds: 600
    required: true
capture:
  max_output_bytes: 1048576
  redact_patterns:
    - '(?i)(api[_-]?key|token|password|secret)\s*[:=]\s*[^\s]+'
reports:
  retain: 20

Choose credible checks

A fresh Receipt proves only that the configured verifier passed for its declared files. It does not prove that the verifier covers every acceptance criterion. The user does not need to diagnose the exact bug, but the task still needs observable acceptance criteria and a credible command that tests them.

beforedone init is a starting point, not an automatic test designer. It recognizes a Go module and proposes go test ./...; other repositories need an explicit command. It no longer supplies git status --short as a placeholder. Existing configurations and historical receipts are preserved, including any commands the user explicitly chose. Review older generated configurations and replace placeholder checks with a verifier appropriate to the project. Review existing test, build, lint, type-check, package-script, and CI commands, then keep the smallest set that covers the task. Explain which acceptance criteria those commands check. Add a focused regression test when a concrete coverage gap falls within the change.

Suggested Codex prompts

Configure a repository once:

Connect this repository's existing verification command to BeforeDone. Reuse
the project's normal checks and include their source, tests, fixtures, and build
inputs in relevant_files. Use command-based init if supported by the installed
CLI; otherwise edit the generated YAML. Keep the setup small and explain any
task requirement the existing checks do not cover.

Verify a task:

Use BeforeDone for this task. Run affected configured checks through BeforeDone
and reuse results that still match the files. At handoff, use one gate result
to confirm all required checks. Inspect individual receipts only if needed.
Report any acceptance criterion the configured checks do not cover.

These prompts help Codex propose and apply the verification contract; they do not turn natural-language confidence into a Receipt. Review .beforedone.yaml before relying on it.

Do not place credentials in verifier command-line arguments or sensitive names in verifier paths. Evidence receipts intentionally preserve the actual argv and working-directory metadata so a reviewer can see what ran; those structural fields are not rewritten by output redaction. Use environment-based or native credential mechanisms, and review receipt/report metadata before sharing it.

Daily workflow

Run an affected check through BeforeDone, then confirm completion:

beforedone check test
beforedone gate

gate lists the verdict and freshness of each required check without running the verifiers. If a previous result may still apply, start with gate and rerun only checks that need fresh evidence. Changes outside a check's file scope do not require repeating it.

An active agent integration supplies the final gate automatically. For that route, a separate manual gate is optional. Receipt inspection is for details or diagnosis, rather than an extra step after every check:

beforedone receipt test
beforedone gate --json

The gate returns both a decision and an evidence verdict. Missing, failed, invalid, or stale required evidence blocks completion. A verifier receipt that is itself INCONCLUSIVE preserves the existing non-blocking warning behavior: the decision is allow, the verdict and process exit remain INCONCLUSIVE, and system_message explains the uncertainty. Adapters must read decision; they must not infer it from the exit code alone.

A successful process creates a PASS receipt for the current relevant-file fingerprint. Changing a relevant file makes that receipt stale; changing a file outside the check's configured patterns does not. A word such as PASS in ordinary command output never overrides a non-zero process exit.

Relevant globs also include matching Git-ignored files such as generated Go sources, and the fingerprint includes executable-mode changes. Git applies the ignored-file pathspec before BeforeDone streams results, with hard file-count, listing-size, and content-size limits; exceeding a limit fails closed instead of silently omitting evidence. Submodule contents are not fingerprinted in v1: if a relevant_files pattern may cover a Git submodule or a path below it, the check fails closed instead of issuing reusable evidence.

Prospective study plans and evolution ledgers belong to the research, memory, or runtime-evolution system that created them. They do not create or refresh a Completion Receipt. BeforeDone remains responsible only for the final configured checks and current relevant-file fingerprint; see the evolution study boundary.

One product, five delivery forms

  • CLI: the source of truth for checks, receipts, incidents, replay, and adapter validation.
  • Codex Git Marketplace Plugin: the automatic experience. It bundles the Stop Hook and both BeforeDone skills, while delegating all evidence decisions to the CLI.
  • Standalone Skills Pack: the same two workflows without lifecycle hooks or Stop enforcement.
  • DeepSeek Harness community Bundle: native session-event capture plus a pre-completion gate and one bounded corrective continuation.
  • Project-local Pi extension: bounded Pi lifecycle capture plus a post-settlement evidence decision and one corrective continuation.

The CLI is required in every setup. For Codex, choose exactly one integration route:

  1. the Plugin for hooks plus both bundled skills;
  2. the standalone Skills Pack for a manual workflow; or
  3. project-local hooks from beforedone setup codex for the automatic gate without installing the Plugin.

Do not combine these routes in one Codex environment. The Plugin plus standalone Skills duplicates the workflows; the Plugin plus project-local hooks runs the lifecycle integration twice.

For Pi, use beforedone setup pi. Do not load another copy of the generated extension in the same Pi runtime.

For DeepSeek Harness, install dsh-beforedone into the selected profile. Do not combine it with another BeforeDone lifecycle adapter for the same session.

3. Choose an agent integration

Route A: Codex Git Marketplace Plugin

The Git Marketplace Plugin includes the Stop Hook and both skills. Install the CLI first, then add the public Git marketplace:

codex plugin marketplace add rrrrrredy/beforedone

Restart the ChatGPT desktop app, open the Plugins Directory in Codex, select the beforedone marketplace source, open BeforeDone, and choose Install. Then open /hooks, review and trust the BeforeDone hooks, and start a new task so the bundled skills are available. The Plugin does not download or update the CLI silently; a missing executable produces an actionable error.

To update this route:

go install github.com/rrrrrredy/beforedone/cmd/beforedone@latest
codex plugin marketplace upgrade beforedone

Then open BeforeDone in the Codex Plugins Directory and apply the offered update. If that surface does not offer an in-place update, uninstall and install the Plugin again from the refreshed marketplace.

To remove this route, open BeforeDone in the Codex Plugins Directory and select Uninstall plugin. If you no longer want the repository marketplace either, remove that source separately:

codex plugin marketplace remove beforedone

Removing the marketplace source is not a substitute for uninstalling the Plugin in the Plugins Directory.

Route B: standalone Skills Pack

Choose this route instead of the Plugin. It installs the same workflows but cannot observe lifecycle events or enforce a Stop Gate.

Ask Codex to run the built-in skill installer once for each exact path:

$skill-installer install https://github.com/rrrrrredy/beforedone/tree/main/skills/verify-before-done
$skill-installer install https://github.com/rrrrrredy/beforedone/tree/main/skills/investigate-agent-incident

The skills become available on the next Codex turn. To pin them to v1.2.0, replace /tree/main/ with /tree/v1.2.0/ in both URLs.

You can also install both through the third-party skills.sh CLI. BeforeDone itself has no telemetry, but skills.sh is a separate tool and may collect its own usage data. Disable that installer telemetry explicitly if desired:

DISABLE_TELEMETRY=1 npx skills add rrrrrredy/beforedone --skill verify-before-done --skill investigate-agent-incident --agent codex --global --yes

PowerShell:

$env:DISABLE_TELEMETRY = '1'
npx skills add rrrrrredy/beforedone --skill verify-before-done --skill investigate-agent-incident --agent codex --global --yes
Remove-Item Env:DISABLE_TELEMETRY

To update skills installed by $skill-installer, remove or back up only verify-before-done and investigate-agent-incident from $CODEX_HOME/skills (by default ~/.codex/skills), rerun the two install prompts, and start a new turn. To uninstall this route, remove only those same two directories.

If you used skills.sh, keep using that installer for lifecycle management:

DISABLE_TELEMETRY=1 npx skills update --global verify-before-done investigate-agent-incident
DISABLE_TELEMETRY=1 npx skills remove --global verify-before-done investigate-agent-incident

Route C: project-local Codex hooks

Choose this route instead of the Plugin and standalone Skills. It writes the BeforeDone lifecycle handlers to the current repository's .codex/hooks.json and pins them to the absolute CLI executable found during setup:

beforedone setup codex

Open /hooks, review and trust the project hooks, then start a new task. If the CLI path changes during an upgrade, rerun beforedone setup codex. On Windows, setup generates a PowerShell invocation with a quoted executable path. Rerun setup with the current CLI to replace older Windows handlers, then trust the updated definitions. Repeated setup does not duplicate handlers. Remove only the BeforeDone project hooks with:

beforedone setup codex --remove

DeepSeek Harness: community Bundle

Install BeforeDone CLI v1.1.1 or newer, initialize the target repository, then add the Bundle to the Harness profile you use:

dsh plugin --profile headless add dsh-beforedone@0.1.0
dsh --profile headless --dump-config

The Bundle subscribes to the native append-only session log, flushes normalized metadata through the Adapter Kit, and runs beforedone gate --json at agent/turn-stopping. A blocking or unsafe result becomes one durable steering message. The next stop is reevaluated, but the same turn is never forced more than once.

Prompt text, reasoning, tool arguments, and tool output are not copied into .git/beforedone; the normalized ledger contains the local session working directory, lifecycle identifiers, message source/plugin names, tool names, and result status. Missing CLI support, timeouts, truncated output, partial ingestion, and damaged JSON fail loud instead of becoming an implicit success.

Full compatibility, configuration, test, privacy, and removal instructions are in integrations/deepseek-harness/README.md. This is a community plugin, not an official DeepSeek plugin.

Pi: project-local extension

Run this instead when the repository is used through Pi:

beforedone setup pi

The command writes .pi/extensions/beforedone.ts and pins it to the absolute BeforeDone executable found during setup. Review the file, approve Pi's project-trust prompt, and start a new Pi session. Rerun setup if the CLI path changes; remove only this generated extension with:

beforedone setup pi --remove

The extension records session_start, input metadata, tool start/finish, agent_settled, and session_shutdown through the normalized Adapter contract. It deliberately does not persist prompt text, tool arguments, tool output, or a raw transcript. Its branch-aware custom entry permits at most one automatic correction. Interactive or RPC input resets the guard; extension-originated input shares the existing guard.

Pi exposes agent_settled after its automatic retry, compaction, and queued continuation paths are exhausted. That makes the integration useful for a corrective follow-on, but it is not equivalent to Codex's pre-completion Stop hook: the first unsupported final message may already be visible before BeforeDone sends the corrective user message. The one-retry guard then allows the next settled result without creating an infinite loop.

Advanced: incidents and replay

Create a self-contained HTML report, machine-readable JSON, and Replay Case from the current repository evidence:

beforedone incident
beforedone incident --correction "The parser still mishandles escaped delimiters."
beforedone incident --transcript path/to/codex-transcript.jsonl

The report contains a timeline, Claim/Evidence Matrix, missing or stale evidence, and the earliest divergence supported by the available evidence. Its precision is exactly one of exact_event, time_window, or unlocated. An exact event requires an explicit match to a verified failing Receipt; a time window must be bounded by observed events around that check. Generic non-zero tool exits and later user corrections do not manufacture a location. BeforeDone does not recover hidden reasoning or chain of thought.

An optional transcript is unstable narrative context, not a trust source and not an input to First Observable Divergence. BeforeDone accepts at most 4 MiB, applies redaction, and stores only a bounded 16 KiB narrative excerpt plus its SHA-256 digest and a truncation flag; it does not copy the raw transcript into the incident.

Replay analysis never runs an external command:

beforedone replay analyze

Verification is also a dry run by default. It displays a plan sourced only from the current repository configuration; argv found in an imported Replay Case is ignored:

beforedone replay verify
beforedone replay verify --check test

Only an explicit --execute runs configured checks in a temporary detached Git worktree:

beforedone replay verify --check test --execute

BeforeDone disables repository Git hooks while it creates that internal worktree. The configured verifier still runs normally after checkout.

BeforeDone does not provide network isolation. A configured verifier can use the network, credentials, and other resources available to that process. Replay captures verifier output through the configured capture.max_output_bytes limit before redaction and report truncation, so an unbounded verifier cannot create an unbounded in-memory result.

Commands and exit codes

beforedone init [--files <pattern>]... [-- <command> [args...]]
beforedone doctor
beforedone setup codex [--remove]
beforedone setup pi [--remove]
beforedone check <check-id>
beforedone receipt [check-id]
beforedone gate
beforedone incident [--correction <text>] [--transcript <path>]
beforedone replay analyze [replay-case.json]
beforedone replay verify [replay-case.json] [--check <id>] [--execute]
beforedone adapter ingest [file|-]
beforedone adapter test [path]
beforedone licenses

Add --json to any public command for schema_version: 1 machine output.

Code Meaning
0 command succeeded or verdict is PASS
1 verdict is FAIL
2 verdict is INCONCLUSIVE
64 invocation or configuration error
70 internal error

beforedone incident can successfully write its artifacts and still exit 1 or 2, because the exit code represents the incident's evidence verdict.

Local data, privacy, and retention

.beforedone.yaml is repository configuration and normally belongs in version control. Runtime artifacts live under .git/beforedone so they do not pollute the working tree. They include:

  • the local receipt key, receipts, check logs, and latest aliases;
  • a normalized event ledger containing bounded summaries rather than a required raw transcript;
  • incident JSON, self-contained HTML reports, Replay Cases, and—when supplied—a redacted bounded narrative excerpt with transcript metadata.

BeforeDone applies built-in secret patterns plus capture.redact_patterns and size limits before persisting captured check output, event summaries, replay output, user corrections, and the optional transcript excerpt. Built-ins cover sensitive assignments, common OpenAI/GitHub/Slack/Google token forms, AWS access key IDs, PEM private-key blocks, and credential-bearing URIs. Redaction remains best effort, not a guarantee, and cannot cover every provider or encoding. It does not rewrite receipt argv or path metadata; never put credentials in command-line arguments, and review artifacts before sharing them.

reports.retain prunes older incident directories after a new incident is created. In v1 it does not automatically prune receipts, logs, or the event ledger. To erase all local BeforeDone evidence, first uninstall the selected agent integration, then manually remove .git/beforedone after reviewing the path. Remove .beforedone.yaml separately only if the repository should no longer define BeforeDone checks.

The CLI, Plugins, Bundle, and Skills contain no BeforeDone telemetry, hosted API, or cloud account. See the privacy page for the separate website and third-party-tool boundaries.

Security and trust boundary

BeforeDone is designed to catch missing or stale verifier evidence at a cooperative or fallible Agent's completion boundary. Codex can block its first Stop attempt; DeepSeek Harness can request one correction before the turn closes; Pi can request one correction after settlement. It is not a security boundary against a malicious process with the same operating-system identity and repository write access.

Such a process can read or replace .git/beforedone/receipt.key, edit .beforedone.yaml, alter runtime artifacts, or run a trivially passing allowed check. It can therefore manufacture a self-consistent PASS. Receipt signing detects corruption and inconsistent artifacts within the supported workflow; it is not remote attestation and does not make an untrusted same-user Agent honest.

Treat BeforeDone as an inspectable process guardrail. Use OS isolation, least-privilege credentials, protected configuration, or an external verifier when the Agent itself is inside the threat model. Read SECURITY.md before relying on receipts in a hostile environment.

Adapters

The v1 normalized event contract covers SessionStarted, PromptSubmitted, ToolStarted, ToolFinished, AgentStopping, and SessionEnded. Codex and the dsh-beforedone community Bundle are supported pre-completion adapters; beforedone setup pi supplies a Pi adapter whose stop_retry capability means one post-settlement continuation, not a pre-settlement block. The public schemas, fixtures, and beforedone adapter test command form an Adapter Kit for future integrations; their presence is not a compatibility promise for other agents. A normalized event is limited to 256 attributes and 1 MiB after JSON encoding; the local event ledger is read fail-closed once it exceeds 64 MiB. Review and rotate the ledger before that boundary if a long-running repository produces many events. The v1 writer revalidates committed segments and ID claims before every append; this favors integrity over constant-time writes, so rotate earlier if hook latency starts approaching the configured timeout on a very large ledger. Event IDs must be unique within the ledger. BeforeDone stores writer batches as immutable, content-addressed segments under .git/beforedone/events/, checks the hashed-ID index against committed segment metadata, and rejects missing or duplicate claims instead of allowing an ambiguous Incident Timeline or Replay Case. A pre-v1 events.jsonl is imported once; if an older BeforeDone process continues writing that file after migration, reads and writes fail closed until the version mismatch is resolved.

Upgrade and complete removal

All five delivery forms share the BeforeDone compatibility boundary. Upgrade the CLI first, then refresh the selected integration using the instructions above. Run beforedone doctor in each configured repository after upgrading.

For a complete removal:

  1. uninstall the Plugin in the Plugins Directory, remove the two standalone skill directories, run beforedone setup codex --remove, or run beforedone setup pi --remove, or run dsh plugin --profile <profile> remove dsh-beforedone—whichever integration you selected;
  2. locate the CLI with command -v beforedone on macOS/Linux or Get-Command beforedone in PowerShell, then remove the binary you installed;
  3. optionally remove .git/beforedone and .beforedone.yaml from each repository after reviewing what will be deleted;
  4. if applicable, run codex plugin marketplace remove beforedone to remove the Git marketplace source.

Evidence and technical report

The empirical technical report freezes the protocol, 144 eligible confirmatory outcomes, analysis, and reproducibility artifact. One superseded attempt that produced no outcome is retained for audit and excluded from all effectiveness denominators. Every condition observed 0/60 unsupported completions in the claim-supportable subset, so the report makes no superiority claim; it documents the mechanism, auditability, and measured verifier cost.

The separate beforedone-paper repository contains the full protocol, run records, analysis code, and report sources. This keeps the product checkout focused on the CLI and preserves the study against the exact implementation it evaluated.

Read the report and artifact

Contributing and license

BeforeDone is licensed under Apache-2.0. Like MIT, it allows commercial use, modification, and redistribution, but it also gives contributors and users an explicit patent license and defines contribution, NOTICE, and trademark boundaries. Contributions use the Developer Certificate of Origin rather than a CLA; sign commits with git commit -s. See CONTRIBUTING.md, SECURITY.md, TRADEMARKS.md, and THIRD_PARTY_NOTICES.

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类开发工具
规则置信度高

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: developer-tools、cli。