Skip to content

Commit 80cfcef

Browse files
committed
Document adaptive self-improvement test scope
1 parent c74aef0 commit 80cfcef

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

docs/agent-kv-context-fixes.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,50 @@ Verification:
223223
- `make test-kv-cache-benefit`
224224
- `git status --short`
225225

226+
## 7. Adaptive Self-Improvement E2E Scope
227+
228+
This test demonstrates the agent loop, not a real DS4 code optimization.
229+
230+
It means:
231+
232+
- DS4 is given a temporary repository with a small failing Python project.
233+
- DS4 must inspect repository state, fix the bug, run the tests, inspect the
234+
diff, checkpoint the context, restore it, and prove the tests still pass.
235+
- If the native Git tool is available, the prompt asks DS4 to use it for
236+
`status` and `diff`.
237+
- If the native Git tool is not available, the same test falls back to the
238+
existing `bash` path with `git status --short` and `git diff`.
239+
240+
Before:
241+
242+
```text
243+
context tools work in isolated calls -> less proof of agent-level usefulness
244+
```
245+
246+
Now:
247+
248+
```text
249+
agent fixes a controlled project -> checkpoints -> restores -> verifies state
250+
```
251+
252+
The limitation is intentional. This test does not claim that DS4 found and
253+
optimized DS4's own C code. A stronger follow-up test should run against DS4
254+
itself: ask the agent to inspect the repository, choose one small measurable
255+
optimization, implement it, run the relevant benchmark or e2e check, inspect
256+
the diff, checkpoint, restore, and record whether the metric improved.
257+
258+
That DS4-on-DS4 loop is the ideal product demonstration, but it is a slower and
259+
less deterministic test than this PR should require by default. The controlled
260+
temporary repository keeps this PR's regression signal clear while preserving a
261+
direct path to the stronger self-optimization loop.
262+
263+
Verification:
264+
265+
- `make test-agent-context-self-improvement`
266+
- The generated ledger records `git_status_mode`, `git_diff_mode`,
267+
`context_checkpoint_before`, `context_checkpoint_after`,
268+
`context_restore_used`, `tests_before_restore`, and `tests_after_restore`.
269+
226270
## Test Plan
227271

228272
Run:
@@ -231,6 +275,7 @@ Run:
231275
make test
232276
make test-agent-context-compact-canary
233277
make test-kv-cache-benefit
278+
make test-agent-context-self-improvement
234279
git status --short
235280
```
236281

docs/agent-kv-context-tools.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,49 @@ guard that checks whether compaction preserves facts explicitly marked as
715715
critical for the next action while those facts are pushed out of the recent
716716
verbatim tail.
717717

718+
12. Adaptive context self-improvement e2e.
719+
720+
Run the optional self-improvement target:
721+
722+
```sh
723+
make test-agent-context-self-improvement
724+
```
725+
726+
This target is intentionally separate from default `make test`: it requires a
727+
real model/backend and asks DS4 to operate a complete agent loop. The harness
728+
creates a temporary repository with a small failing Python project, then the
729+
prompt requires DS4 to:
730+
731+
- create a context checkpoint before changing the project,
732+
- inspect repository status,
733+
- read and fix the failing code,
734+
- run the project test,
735+
- inspect the resulting diff,
736+
- create a second context checkpoint after the test passes,
737+
- restore from that checkpoint,
738+
- inspect repository status again,
739+
- run the test again,
740+
- write a ledger with the exact actions and final result.
741+
742+
The Git inspection step is adaptive. If the model-visible schemas include the
743+
native Git tool, the prompt asks DS4 to use it for `status` and `diff`. If that
744+
tool is absent, the same prompt requires the existing `bash` path with
745+
`git status --short` and `git diff`. This keeps the context/KV branch
746+
independent from the Git-tool branch while still letting the same test exercise
747+
the native Git path after integration.
748+
749+
This test is not a claim that DS4 has optimized DS4 itself. It is a controlled
750+
regression test for the agent loop shape: inspect, edit, test, diff,
751+
checkpoint, restore, retest, and record evidence.
752+
753+
The stronger product demonstration should be a DS4-on-DS4 optimization loop:
754+
ask DS4 to inspect this repository, select one small measurable optimization,
755+
implement it, run the relevant benchmark or e2e check, inspect the source diff,
756+
checkpoint and restore the successful state, and record whether the metric
757+
improved. That is the right next target, but it should remain an optional slow
758+
evaluation because it is more expensive and less deterministic than a controlled
759+
temporary-repository regression.
760+
718761
### Resume Point: 2026-05-25
719762

720763
The DS4-generated context loop was run successfully with:

0 commit comments

Comments
 (0)