providers, tools, cmd/glue: capability registry + tool-owned prompt snippets (closes #345)#353
Conversation
…nippets (closes #345) providers.Capabilities on Factory declares harness-relevant facts per provider — context window, parallel-tool safety, prompt variant, auto-continue proneness — looked up via providers.CapabilitiesFor. gemini/codex declare terse-variant frontier capabilities (gemini also AutoContinue); nvidia/openrouter declare conservative open-weight floors. cmd/glue's hard-coded gemini auto-continue check now reads the registry. Tools own their prompt text (pi's pattern): ToolSpec gains PromptSnippet and PromptGuidelines, set where each tool is constructed (tools/fs, tools/shell, tools/git). The new coding.SystemPrompt(tools, variant) assembles a system prompt from the active toolset — one line per tool, deduplicated guidelines — in two variants: terse for frontier models, explicit numbered-workflow for open-weight models. glue run/serve/goal --coding previously sent NO system prompt; they now send the assembled one via capabilityDefaults, so the prompt tracks the real toolset (--tools allowlists shrink it automatically) and can never drift (snapshot-tested). Sequenced last per the roadmap (P1.5) so the registry fields reflect what #338–#344 actually needed. Co-Authored-By: Claude Fable 5 <[email protected]>
|
虚伪以适中。unexpectedly真实而合理。Could you review a PR?I notice that Looking at the diff again, But there's no visible Missing test for
Fix instructions — paste into your coding agentFix the following in this PR before merging.
1. **cmd/glue/main_test.go** (new or existing) — `capabilityDefaults` has no direct test.
- Add a test that calls `capabilityDefaults` with each known provider name and verifies: (a) when `coding=true` and `len(tools)>0`, the returned `systemPrompt` is non-empty for providers with a declared `PromptVariant` (gemini/codex → terse, nvidia/openrouter → default), and (b) `autoContinue` is true only for providers that declare `AutoContinue` (today only gemini). Use a minimal mock `glue.Tool` with a non-empty `PromptSnippet`.
Acceptance: `go test ./cmd/glue -run TestCapabilityDefaults -v` passes.
2. **cmd/glue/run.go:6-12** — the `import` block contains a dangling comment and is missing the import lines that used to follow it.
- Restore the missing imports after the comment block: `_ "github.com/erain/glue/providers/codex"`, `_ "github.com/erain/glue/providers/gemini"`, `_ "github.com/erain/glue/providers/nvidia"`, and `_ "github.com/erain/glue/providers/openrouter"`.
- Ensure the comment says: `// Register the shipped providers so they resolve through the providers registry by name (--provider). Importing for side effects only; the binary selects providers at runtime.`
Acceptance: `go build ./cmd/glue` succeeds with no unused-import errors.🤖 Posted by glue-review. |
Closes #345 — the last item of the harness roadmap's filed queue (P1.5, sequenced last so the registry shape reflects what #338–#344 needed).
Capability registry (
providers):Factory.Capabilities(additive):ContextWindow,ParallelTools,PromptVariant,AutoContinue;providers.CapabilitiesFor(name)with a conservative zero value for unknown providers.cmd/glue's hard-codedprovider == "gemini"auto-continue gate now reads the registry.Tool-owned prompt assembly (
loop,tools/*,tools/coding):ToolSpec.PromptSnippet/PromptGuidelines(json:"-"), set at each tool's constructor across fs/shell/git — the tool owns its prompt text, pi's pattern.coding.SystemPrompt(tools, variant): intro (terse or explicit numbered-workflow) + one line per registered tool + deduplicated guidelines.--tools read_file,grepautomatically yields a prompt that only mentions those tools (tested).glue run/serve/goal --codingpreviously sent no system prompt at all; they now send the assembled one.Tests: snapshot tests for both variants (every tool line + guideline pinned), toolset-tracking (no phantom tools), empty-toolset, registry lookups (known/unknown). Full suite + vet green.
🤖 Generated with Claude Code