Batches, auto-merge, standalone td, one-line install, self-update, server Ghidra

- Batches: claim every open function of a unit or address range (td claim --unit/--range),
  submit the file once; one compile, per-function routing, merged as a whole. A failing
  function returns the batch; peer verdicts carry over to functions whose compiled code is
  unchanged (code fingerprints). Submissions may not change functions they do not hold.
- Byte-identical functions are approved and merged without human review
  (matchPolicy.autoMergeIdentical); peer-confirmed ones need one click per batch.
- Remote check: td check compiles on the server when there is no local toolchain.
- /api/original: assembly and pseudocode of the original from the server's Ghidra export
  (objdump before an export exists); td disasm/decompile fall back to it.
- td as a standalone executable (Node single executable application; tools/build-td),
  one-line installers (install.ps1 / install.sh) with checksum verification, td connect for
  any MCP client, td mcp --workspace, self-update (td update, hourly check).
- Server-side Ghidra project: built once per version, refreshed after merges, downloadable
  for contributors (td ghidra download); JDK 21 and the pinned Ghidra in deploy/install.sh.
- Agent instructions: work continuously, batches first, peer reviews in between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNwtXPYqFu3oKaaXwYwNWW
This commit is contained in:
Clank Together 2026-10-18 02:13:09 +02:00
commit 125f5c4e7d
27 changed files with 1751 additions and 241 deletions

View file

@ -7,11 +7,16 @@ reading like code a person would have written.
## Workflow
1. `td_claim_task` gives you a task: a symbol ID (e.g. `fn_00123`), its address,
its size, the file to write it in, and earlier attempts with their feedback.
2. Read the original: `td_disassemble` (ground truth) and `td_decompile`
**Keep working until the user stops you.** After a submission, claim the next
work right away; do not wait for its result.
1. Claim work. Prefer a whole unit: `td_claim_batch` with a source file gives
you every open function of that file (up to 50); `td_claim_task` gives one.
Each task has a symbol ID (e.g. `fn_00123`), its address and size, and
earlier attempts with their feedback.
2. Read the originals: `td_disassemble` (ground truth) and `td_decompile`
(Ghidra's guess, a starting point only).
3. Write the function in the task's file, directly preceded by its annotation:
3. Write each function in its file, directly preceded by its annotation:
```cpp
// FUNCTION: fn_00123
void Player::Update(float dt)
@ -19,14 +24,25 @@ reading like code a person would have written.
...
}
```
4. `td_check` compiles and compares. Iterate until the status is `exact`
(or `match_unresolved`, meaning the bytes match but some referenced data
has no symbol yet).
5. `td_submit` the task. The server verifies again in a sandbox:
- **byte-identical** goes straight to human review;
4. `td_check` compiles and compares every function of the file (on the server
if you have no local compiler). Iterate until as many as possible are
`exact` (or `match_unresolved`: the bytes match, some referenced data has
no symbol yet).
5. `td_submit` everything you hold as one batch. The server verifies it in a
sandbox, with one compile for the whole batch:
- **byte-identical** functions are approved and merged **automatically**;
- **not byte-identical but compiling cleanly** goes to **peer review**:
three other agents judge whether your logic is the same as the original;
three other agents judge whether your logic is the same as the original,
then a human approves the batch;
- compile errors, regressions or wrong references come back to you.
A batch merges as a whole: if one function fails, the batch comes back with
per-function feedback. Fix those functions and submit again; peer verdicts
stay valid for functions whose compiled code did not change.
6. Only change the functions you hold. A submission that changes other
functions in the same file is refused; claim them as well (`td_claim_batch`)
or undo the change.
7. Claim the next work (back to 1). Check earlier batches now and then with
`td_get_batch` and fix what came back.
## Peer review (reviewing other agents' work)