kit-provider-adapters
Skill0 starsChanged 15 days agoMITView on GitHub
Add or change a model provider (Anthropic, OpenAI, xAI, OpenAI-compatible/local) or an external agent driver (Claude Code, Codex, Grok, ACP) in Kit — streaming, tool calls, errors, cost and tests. Use for any work in crates/kit-providers or crates/kit-agents.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-and-interface-designSkill
- browser-testing-with-devtoolsSkill
- ci-cd-and-automationSkill
- code-review-and-qualitySkill
- code-simplificationSkill
- context-engineeringSkill
- debugging-and-error-recoverySkill
- deprecation-and-migrationSkill
- documentation-and-adrsSkill
- doubt-driven-developmentSkill
- frontend-ui-engineeringSkill
- git-workflow-and-versioningSkill
- idea-refineSkill
- incremental-implementationSkill
- interview-meSkill
- observability-and-instrumentationSkill
- performance-optimizationSkill
- planning-and-task-breakdownSkill
- security-and-hardeningSkill
- shipping-and-launchSkill
- source-driven-developmentSkill
- spec-driven-developmentSkill
- test-driven-developmentSkill
- using-agent-skillsSkill
- kit-ci-triageSkill
- kit-evalsSkill
- kit-releaseSkill
- kit-tuiSkill
- a11y-passSkill
- add-readmeSkill
- api-docsSkill
- changelogSkill
- cli-helpSkill
- code-reviewSkill
- completeness-qaSkill
- data-checkSkill
- deps-hygieneSkill
- fix-bugSkill
- project-setupSkill
- pr-readySkill
- ship-checklistSkill
- workspace-setupSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Never read another tool's credential file.
- Very specific: line 29
Cost: use the provider's reported cost when there is one (xAI ticks, Claude total_cost_usd, Grok's reported cost).
- Distinctive: line 32
Context window comes from the provider,: never a default guess.
- Very specific: line 45
Run cargo test -p kitctl-providers -p kitctl-agents and the 3-OS CI before calling it done.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Kit provider adapters and harness drivers
The design is docs/PRD.md §6. Two kinds of adapter, two crates:
| Kind | Crate | Interface | Example |
| Model provider (Kit's own agent) | crates/kit-providers | Provider trait: models(), stream(Request) -> EventStream | anthropic.rs, openai_compatible.rs |
| External agent driver (harness) | crates/kit-agents | Agent trait: probe(), spawn() → AgentHandle; events become KitEvent | claude.rs, codex.rs, grok.rs |
Rules
- Check the real docs, never guess a flag. Record the doc URL and the date in a comment above the
invocation, and the CLI version you tested against. Upstream flags change:
codex --full-autoandcodex mcp-serverwere removed in 2026. - One file per provider or driver, ≤ 600 lines. Shared SSE parsing and retry live in one module.
- Prompts never go on argv (Windows
cmdinjection and length limits). Use stdin, a prompt file the tool's published docs list, or the protocol (ACP). - No shells. Spawn the real executable; on Windows resolve
.cmdshims to their entry point as the existing adapters do. - Auth stays where it is. Providers: env var → OS keychain (
kit:<provider>) →key_command. Drivers: the tool's own login, checked with its status command (claude auth status,codex login status). Never read another tool's credential file. Never log a key; keys never enter a tool's environment. - Errors map to the closed set:
Auth,RateLimited{retry_after},ContextOverflow,Transient,BadRequest,Fatal. The user sees the class in words and the fix. - Cost: use the provider's reported cost when there is one (xAI ticks, Claude
total_cost_usd, Grok's reported cost); otherwise compute from usage ×prices.tomland mark it≈. Never sum Claudetotal_cost_usdacross resumes (it already includes earlier spend). - Context window comes from the provider, never a default guess.
- Published docs beat repo docs. A flag found only in a tool's repo or user guide, not on its published CLI reference, is unverified: don't depend on it until a live check against the released CLI passes.
Tests (required)
- Recorded streams: capture real responses once (success, tool call, rate limit, context overflow,
auth failure), strip keys and personal data, and commit them under the crate's fixtures folder
(
crates/kit-agents/src/fixtures/for drivers). CI replays them; CI never calls a real API. - Live tests go behind the
livecargo feature and are run by hand with a budget. - Drivers: replay a transcript through the parser, and use a fake binary (see
crates/kit-cli/tests/land_cli.rs) for exit codes, kill, resume and a version whose stream changed shape, which must fail loudly with the version named. - Run
cargo test -p kitctl-providers -p kitctl-agentsand the 3-OS CI before calling it done.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

