-
Notifications
You must be signed in to change notification settings - Fork 2
README value-prop restructure + typed tool registration (nanocodex comparison, Workstream A) #845
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
Open
dennisonbertram
wants to merge
2
commits into
main
Choose a base branch
from
claude/reader-cleanup-value-prop-spooyb
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
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,72 @@ | ||
| # Cleaner Boundaries and Tool Ergonomics (nanocodex comparison) | ||
|
|
||
| Status: Workstream A landed; B and C planned. | ||
|
|
||
| A code comparison against [nanocodex](https://github.com/gakonst/nanocodex) — a | ||
| deliberately small, library-first Rust agents SDK — surfaced three improvements | ||
| worth adopting here, without giving up what makes go-code different (a local | ||
| product with a service API, multi-provider routing, approvals, persistence). | ||
|
|
||
| ## Workstream A — Typed tool registration (landed) | ||
|
|
||
| Nanocodex's `#[tool]` macro derives the JSON schema from a typed function | ||
| signature. Our Go equivalent is `tools.NewTyped` / `tools.MustTyped` | ||
| (`internal/harness/tools/typed.go`): define a tool as a typed function over an | ||
| args struct and the Parameters schema is derived by reflection from the | ||
| struct's fields and tags (`json` name + omitempty/pointer optionality, `desc`, | ||
| `min`/`max`, `enum`). The schema and the decode target can no longer drift | ||
| apart, and per-tool boilerplate (unmarshal, error wrapping, result | ||
| marshalling) disappears. | ||
|
|
||
| Pilot migrations: `glob` and `git_status`. Schema parity with the previous | ||
| hand-written literals is locked in by `typed_parity_test.go` (canonical-JSON | ||
| comparison), alongside behavior tests. Remaining hand-written tools migrate | ||
| opportunistically — `NewTyped` wraps the existing `Tool`/`Handler` types, so | ||
| both styles coexist and the registry, `ParallelSafe`/`Mutating` flags, policy | ||
| wrapping, and approval machinery are untouched. | ||
|
|
||
| ## Workstream B — Split `internal/harness` (planned) | ||
|
|
||
| `internal/harness` is a single ~100k-line package with 124 root files; its | ||
| types file imports forensics, observational memory, store, and working memory | ||
| directly. Nanocodex's five-crate layout (dependency-light core / service / | ||
| tools / mcp / facade) is the model. Plan: | ||
|
|
||
| 1. **Inventory PR (no code moves):** script the intra-package dependency graph | ||
| and record the target package map here. Candidate clusters from the file | ||
| layout: `event` (events.go), `permission` (permission_rules, plan_mode), | ||
| `convstore` (conversation_store*, sqlite), `broker` (approval / ask-user / | ||
| checkpoint brokers), `registry` (registry.go + typed registration), with | ||
| the runner loop remaining in `harness`. | ||
| 2. **Extract leaf-first, one cluster per PR, using type aliases** (`type X = | ||
| newpkg.X` left in `package harness`) so the ~30 importing packages are | ||
| untouched in the move PR. Each PR is small, CI-green, merged same day — | ||
| never a long-lived split branch (`main` squash-merges concurrently). | ||
| 3. **Importer-update PRs** then retire the aliases cluster by cluster. | ||
| 4. **Guardrail:** a lint or test asserting the extracted core types package | ||
| imports nothing heavier than stdlib, so the boundary stays true. | ||
|
|
||
| Verification per PR: `go build ./internal/... ./cmd/...`, the key-free smoke | ||
| (`go test ./internal/server/... -run TestRunSmoke`), and | ||
| `scripts/test-regression.sh` before merge. | ||
|
|
||
| ## Workstream C — Public Go client (planned, after B's events extraction) | ||
|
|
||
| An embeddable story shaped like nanocodex's three-line hello world, but honest | ||
| to our architecture: a typed client over the existing HTTP/SSE API rather than | ||
| an in-process runner. | ||
|
|
||
| 1. Graduate the extracted event/run-request wire types to a public package | ||
| (e.g. `pkg/gocode/wire`) that `internal/server` itself imports — a single | ||
| source of truth, no drift, no parity tests to maintain. This is why C waits | ||
| for B's events extraction. | ||
| 2. Build `pkg/gocode`: a `Client` with `StartRun`, `Continue`, `Cancel`, and | ||
| an `Events(ctx, runID)` SSE iterator returning typed events. Marked | ||
| v0/experimental. | ||
| 3. Integration-test against the fake provider (`HARNESS_PROVIDER=fake`). | ||
| 4. Add a short Go example to README's "Build on the API" section. | ||
|
|
||
| ## Sequencing | ||
|
|
||
| A ships first (this PR). B1 (inventory) and B2 (events extraction) next; C | ||
| starts once B2 lands; remaining B extractions continue in parallel with C. | ||
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.
This commit adds a new file under
docs/design, butdocs/design/INDEX.mdstill has no entry fornanocodex-comparison-plan.md.AGENTS.mddirects agents to maintain folder indexes viadocs/runbooks/documentation-maintenance.md, which requires updating the localINDEX.mdimmediately after adding a file, so the documented navigation future agents rely on is now stale; please add a concise index entry for this plan.Useful? React with 👍 / 👎.