-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add bounded autoresearch and context telemetry #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Apollo autoresearch | ||
|
|
||
| `apollo autoresearch` runs bounded experiments against a numeric local metric. | ||
| It measures a baseline, asks the agent for one hypothesis at a time, validates | ||
| the candidate, keeps only improvements, and records every decision in a TOML | ||
| ledger. | ||
|
|
||
| Create `.apollo/autoresearch.toml` in the workspace: | ||
|
|
||
| ```toml | ||
| objective = "Reduce warm startup latency" | ||
| metric_command = "cargo bench --bench startup -- --output-format json | jq -r .median_ms" | ||
| direction = "minimize" | ||
| validation_command = "cargo test --workspace --all-features" | ||
| validation_retries = 2 | ||
| command_timeout_secs = 300 | ||
| samples = 3 | ||
| max_iterations = 10 | ||
| max_duration_secs = 1800 | ||
| ledger_path = ".apollo/autoresearch-ledger.toml" | ||
| ``` | ||
|
|
||
| Run it with: | ||
|
|
||
| ```bash | ||
| apollo autoresearch --workspace . | ||
| apollo autoresearch --workspace . --resume | ||
| ``` | ||
|
|
||
| The metric command must print at least one finite numeric value. Commands in | ||
| the specification are trusted local code and run through `sh -c`; do not use a | ||
| specification copied from an untrusted source. The workspace must be clean at | ||
| startup. Rejected iterations are restored to their checkpoint; ignored | ||
| configuration/state files are restored to their pre-iteration contents, and | ||
| untracked files created by that iteration are removed. Build output under | ||
| `target/` is treated as disposable process state. Run autoresearch in a | ||
| dedicated worktree when experimenting with valuable local files. | ||
|
|
||
| If `ledger_path` is inside the workspace, it must be Git-ignored; an external | ||
| ledger path is also supported. This keeps the durable ledger from becoming an | ||
| unrelated dirty change after an accepted iteration. | ||
|
|
||
| Accepted iterations are committed locally as `autoresearch: iteration N`. | ||
| Pushing is intentionally not automatic. | ||
|
|
||
| The ledger records the branch, the accepted commit, a fingerprint of the | ||
| metric/validation definition, and a unique run chat id. `--resume` refuses to | ||
| continue if the branch, HEAD, or experiment definition no longer matches the | ||
| ledger. | ||
|
|
||
| The autoresearch runner exposes only the runtime and filesystem tool groups to | ||
| the experiment agent. Network, messaging, memory, MCP, dynamic tools, host | ||
| plugins, and workspace skills are not ambient capabilities for this workflow; | ||
| history, personal-context injection, ZKR recall/capture, and reflection are | ||
| also disabled. | ||
|
|
||
| Validation and metric processes are bounded by `command_timeout_secs`, and a | ||
| validation command may be retried with `validation_retries`. The whole run is | ||
| bounded by `max_iterations` and `max_duration_secs`. | ||
|
|
||
| Apollo also records estimated system, history, and tool-definition context in | ||
| aggregate counters in the existing cost tracker. The estimates use four | ||
| characters per token and are useful for comparing harness configurations, not | ||
| for billing. | ||
|
|
||
| ## Design notes | ||
|
|
||
| The loop follows two useful ideas from adjacent agent systems: bounded | ||
| autonomous runs with explicit quality gates and budgets (as in | ||
| [Prime Agent](https://github.com/PrimeIntellect-ai/prime-agent)), and | ||
| capability-oriented access instead of ambient tools (as in | ||
| [Cloudflare OS](https://github.com/cloudflare/cloudflare-os)). Apollo keeps the | ||
| implementation local and Git-backed: there is no hosted worker or remote | ||
| control plane in this workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the configured model is absent from
CostTracker's hard-coded price table—as the defaultgpt-5.5currently is—this newly wired usage recording callsrecord, whose unknown-model fallback assigns zero input and output prices./costand the HTTP summary consequently report paid default-model calls as costing$0; represent unknown pricing explicitly or ensure every selectable default and alias resolves to a real price rather than silently recording free usage.Useful? React with 👍 / 👎.