Skip to content

Commit c194c40

Browse files
committed
feat(skills): add a corbits skill chain for the Corbits packages
1 parent 7c30cb9 commit c194c40

10 files changed

Lines changed: 363 additions & 3 deletions

File tree

‎docs/PRODUCT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ the file path and parse details.
107107

108108
The TUI has an extensible slash-command framework. Built-ins include `/help` (shortcut + command overlay), `/model` (models-only picker for connected accounts; **Alt+A** or `/connect` adds a provider), `/settings`, `/permissions`, `/plugins`, `/clear`, `/new`, `/compact` (fold conversation context now, optional trailing instructions to the summarizer; does not wait for the 60% occupancy governor; idle success shows the fold and does not start a new turn), `/mcp` (enable, disable, or remove servers), `/handoff [optional instructions]` (folds context through the shared operator pipeline, then immediately starts the next turn with the instructions as the inbound content — default copy when omitted; unlike `/compact`, which stops after the fold, handoff always re-infers, so the operator can pivot goals without `/clear`; a handoff issued mid-tool-batch queues behind the in-flight batch and whichever boundary fires first runs the single fold), and `/yolo` (`/yolo [on|off|toggle]`, bare `/yolo` toggles), plus a `/<name>` command per available workflow. `/yolo` persists skip-permissions to the active settings file. That file is the user-global `~/.corbits/settings.json` by default, making the setting machine-wide; explicit `--config <path>` selects a different active file, and `/yolo` writes that file. An ordinary TUI launch without the same `--config` returns to the user-global source and does not modify the custom file. `--dangerously-skip-permissions` and `--yolo` are process-only aliases. Secret-guard and authz still apply. When a session starts with its active persisted setting already on, the TUI and `corbits exec` warn that permission prompts are disabled by saved settings at the active settings path and direct the operator to edit that file to re-enable them. Plugins can register additional commands.
109109

110-
**Default skills** exist out of the gate as first-party slash **actions**, not director names: `/implement`, `/plan`, `/refactor`, `/review`, `/pull-request`, `/issue`, `/docs`, `/interview`. Each one is a how-to playbook — the slash sends the skill body to the primary, which follows the steps. Skills do not assign identity or route the fleet; that stays on director system prompts. Background reference skills (`typescript`, `git-worktrees`, and the `interchange` hub with its `interchange-agents`, `interchange-workflows`, `interchange-run-modes`, `interchange-embed-hub`, and `interchange-client-apps` references) have no slash; the model loads them with `skill_search` and `use_skill`, and each one ends with "need more, go here" pointers to the next skill in the chain. `/review` classifies the target first, then dispatches a selected fleet; `/pull-request` finds or opens the PR for the current branch, and `/review` takes a PR target and reviews it from a worktree; `/docs` is how to maintain PRODUCT / ARCHITECTURE / IMPLEMENTATION; `/implement` takes a plan and a ticket to a pushed branch (worktree, per-commit planner/build/reviewer loop, whole-branch review, push, hand off to `/pull-request`) — it does not steal planning from `/plan`. Substantial coder work consumes a planner / `/plan` plan first; tiny parent-DIY stays plan-optional. `/plan` authors an eng change plan (files, AC, non-goals, risks, ordered steps) and does not implement. `/issue` finds or creates the tracker issue: Linear MCP when available; otherwise it `ask_operator`s for the platform (GitHub etc.) and persists `Preferred issue tracker` in `.corbits/MEMORY.md` (GitHub via `gh issue create`). There is no first-party dispatch skill: the dispatch director orchestrates natively. `typescript` stays `use_skill` only (`user-invocable: false`); `git-worktrees` is a background library that is not listed for `use_skill`. Designer and the other specialists are not slashes; they remain closed directors via `spawn_agent(agent=…)`. There is no catch-all worker. Slash names are also available to the model via `skill_search` (descriptions) then `use_skill` (body). Disable the catalog in `/plugins` (`corbits-skills`) if you want them gone.
110+
**Default skills** exist out of the gate as first-party slash **actions**, not director names: `/implement`, `/plan`, `/refactor`, `/review`, `/pull-request`, `/issue`, `/docs`, `/interview`. Each one is a how-to playbook — the slash sends the skill body to the primary, which follows the steps. Skills do not assign identity or route the fleet; that stays on director system prompts. Background reference skills (`typescript`, `git-worktrees`, and the `interchange` hub with its `interchange-agents`, `interchange-workflows`, `interchange-run-modes`, `interchange-embed-hub`, and `interchange-client-apps` references, and the `corbits` hub with `corbits-inference`, `corbits-system-one`, `corbits-tools`, `corbits-hub-libs`, and `corbits-ui-apps`) have no slash; the model loads them with `skill_search` and `use_skill`, and each one ends with "need more, go here" pointers to the next skill in the chain. `/review` classifies the target first, then dispatches a selected fleet; `/pull-request` finds or opens the PR for the current branch, and `/review` takes a PR target and reviews it from a worktree; `/docs` is how to maintain PRODUCT / ARCHITECTURE / IMPLEMENTATION; `/implement` takes a plan and a ticket to a pushed branch (worktree, per-commit planner/build/reviewer loop, whole-branch review, push, hand off to `/pull-request`) — it does not steal planning from `/plan`. Substantial coder work consumes a planner / `/plan` plan first; tiny parent-DIY stays plan-optional. `/plan` authors an eng change plan (files, AC, non-goals, risks, ordered steps) and does not implement. `/issue` finds or creates the tracker issue: Linear MCP when available; otherwise it `ask_operator`s for the platform (GitHub etc.) and persists `Preferred issue tracker` in `.corbits/MEMORY.md` (GitHub via `gh issue create`). There is no first-party dispatch skill: the dispatch director orchestrates natively. `typescript` stays `use_skill` only (`user-invocable: false`); `git-worktrees` is a background library that is not listed for `use_skill`. Designer and the other specialists are not slashes; they remain closed directors via `spawn_agent(agent=…)`. There is no catch-all worker. Slash names are also available to the model via `skill_search` (descriptions) then `use_skill` (body). Disable the catalog in `/plugins` (`corbits-skills`) if you want them gone.
111111

112112
Providers are **models-first**: there is no standalone `/login` command. `/model` opens a **models-only list** (Recent, Favorites, then connected provider/model rows) — type-to-filter owns printable keys, so Connect is never a bare letter. **Alt+A** or `/connect` opens a dedicated add-provider selector over every first-class kind (OpenAI dual-path ChatGPT OAuth or API key, xAI, OpenCode Zen, Anthropic, Google, OpenCode Go, Z.AI Coding Plan, Ollama, Custom), each annotated with its live account count and never filtered out for “already connected.” **Alt+F** toggles favorite on the highlighted model. **Alt+D** persists the highlighted pair as the default without switching the live session. Advanced provider drill-down (edit/delete/tiers) stays on the advanced surface, not a bare printable key while the model list is filtering. OAuth providers open their existing browser login with a named account step so multiple accounts per kind coexist (`codex/work`, …). API-key providers use the same named-instance step before the key (auth-only form: instance name + key + fixed catalog base URL), so personal and team keys land as distinct catalog rows (`openai/default`, `anthropic/work`, …); reusing a name re-keys that instance after confirm. Custom remains a free-form single endpoint (full manual form). Successful connect refreshes the catalog and reopens the model list focused on the new account’s default model. OpenCode Go lists models from the live `/zen/go/v1/models` catalog (packaged seed on fetch failure), routes each by its protocol metadata (chat completions, OpenAI responses, or Anthropic messages) and can show subscription usage in the status bar when active (rolling 5h / weekly / monthly windows when the usage API responds; omitted on auth or network failure). When Go returns a quota or rate-limit error — including some HTTP 400 responses that carry limit payloads — Corbits classifies them so quota aborts cleanly and short provider rate limits remain retryable. On a free-tier or subscription quota hit, wait for the window to reset or use OpenCode Zen free models.
113113

‎docs/TELEMETRY.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ director ids from `DIRECTOR_IDS` (and the legacy `worker` alias) are reported
7878
by id; project-defined or marketplace profile ids become `custom`.
7979
`skill_used` carries `skill_name`: a first-party skill name reportable by
8080
name from the closed `corbits-skills` allowlist in `src/telemetry/classify.ts`
81-
(the slash workflows plus the background skills `git-worktrees`, `typescript`, and the `interchange` chain), or `custom` for anything else, including bundled background
81+
(the slash workflows plus the background skills `git-worktrees`, `typescript`, and the `interchange` and `corbits` chains), or `custom` for anything else, including bundled background
8282
skills outside the list. Unknown, project-local, and plugin-authored skill
8383
names are never transmitted; `skill_name` is the only identifying-adjacent
8484
property the event can carry.

‎plugins/corbits-skills/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"name": "Corbits Skills",
44
"kind": "command",
55
"defaultEnabled": true,
6-
"description": "Default operator skills and slash commands (implement, refactor, review, pull-request, issue, docs, interview, plan) and background reference skills (git-worktrees, typescript, interchange)."
6+
"description": "Default operator skills and slash commands (implement, refactor, review, pull-request, issue, docs, interview, plan) and background reference skills (git-worktrees, typescript, interchange, corbits)."
77
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
name: corbits-hub-libs
3+
description: Mount Corbits hub libraries (cron, artifacts, memory, mailbox, webhooks, agent-token) and use the embedding and reranking clients.
4+
user-invocable: false
5+
---
6+
7+
# Corbits hub libraries
8+
9+
Six libraries add features to an Interchange hub. They share one shape.
10+
11+
## Shared pattern
12+
13+
- Each exports `createXRoutes(deps)`, a Hono sub-app you mount with `app.route(...)` on `@intx/hub-api`, gated by `requireGrant` (from `createRequireGrant({ grantStore, conditionRegistry })`).
14+
- Each has `runXMigrations(dbConfig, { schema })`. On every boot run `@intx/db`'s `runMigrations` first, then these. They are idempotent and advisory-locked, so replicas are safe.
15+
- Each owns its own Postgres schema. `schema` is the host schema holding `tenant`, `principal`, and `credential`.
16+
- Mount paths: `/api/tenants/:tenantId/<name>`, with `artifacts` at `/api` and `webhooks` at `/api/hooks`.
17+
- Agents reach them through a tool pack (`.../sidecar-bundle`) and run-scoped routes that use an agent token.
18+
19+
## Pick one
20+
21+
| Package | Reach for it when | Notes |
22+
| ---------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
23+
| `@corbits/cron` | An agent should run on a schedule. | Five-field UTC cron. No edit: delete and recreate. At most once per due minute. Pair with webhooks' deliverer. |
24+
| `@corbits/webhooks` | An outside system should trigger a run. | Verifies Slack, Standard Webhooks, bearer. No unsigned mode. Mount outside session middleware. |
25+
| `@corbits/artifacts` | Users or agents produce files or documents to keep. | Versioned. Bytes go through a pluggable `ContentStore` (`InlineContentStore` uses Postgres). No UI. |
26+
| `@corbits/memory` | Agents need shared searchable memory. | Needs Postgres with pgvector, and falls back to full text (`degraded`). Tools: `memory_add`, `memory_search`, `memory_list`, `memory_feed`. |
27+
| `@corbits/mailbox` | Humans need an inbox in the loop (approvals by mail). | For human principals. No UI and no transport: the host supplies `deliver`. |
28+
| `@corbits/agent-token` | A deployed agent calls back into the hub. | Mint and revoke routes plus `requireAgentToken` middleware. Tokens last until revoked. |
29+
30+
## Mount example
31+
32+
```ts
33+
import {
34+
createCronRoutes,
35+
createCronTicker,
36+
createRunTriggerCronDeliver,
37+
} from "@corbits/cron";
38+
import { runCronMigrations } from "@corbits/cron/migrations";
39+
40+
await runMigrations(dbConfig, { schema: "public" });
41+
await runCronMigrations(dbConfig, { schema: "public" });
42+
app.route(
43+
`/api/tenants/:tenantId/cron`,
44+
createCronRoutes({ db, requireGrant }),
45+
);
46+
createCronTicker({
47+
db,
48+
deliver: createRunTriggerCronDeliver(deliverer),
49+
}).start();
50+
```
51+
52+
Run one ticker per hub process. The best real wiring is upstream in `workbench/apps/hub/src/server.ts` and `migrate.ts` (note its older pins), and each README has a "Using with Interchange" section.
53+
54+
## Standalone clients (no hub)
55+
56+
- `@corbits/embedding`: `embedTexts(texts, { baseURL, model })` over any OpenAI-compatible `/v1/embeddings` (OpenAI, Ollama, TEI, vLLM, Jina). It does not store or search.
57+
- `@corbits/reranking`: `rerankDocuments(query, docs, { baseURL, apiStyle: "tei" | "cohere" | "voyage" })` returns `{ id, score }[]`, best first. On failure keep the original order.
58+
59+
## Grants
60+
61+
Libraries declare the grants they need in `package.json` under `interchange.grantRequirements`. Give principals only what they need, for example `cron-schedule:*` create, `memory:search`, `artifact:*` create.
62+
63+
## Need more
64+
65+
- Triggering workflows from these: `use_skill interchange-workflows`.
66+
- A client UI for artifacts, mail, and runs: `use_skill corbits-ui-apps`.
67+
- Hub topology and credentials: `use_skill interchange-run-modes`.
68+
- Catalog: `use_skill corbits`.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
name: corbits-inference
3+
description: Add OpenAI Responses, Codex, xAI, or Ollama inference and OAuth login to Interchange with the Corbits provider packages.
4+
user-invocable: false
5+
---
6+
7+
# Corbits inference and login
8+
9+
| Package | Use it for |
10+
| --------------------------- | --------------------------------------------------------------------------------------- |
11+
| `@corbits/openai-responses` | Any OpenAI Responses endpoint (`/v1/responses`). Backend differences are JSON `quirks`. |
12+
| `@corbits/codex-provider` | ChatGPT subscription ("Login with ChatGPT") as inference. No API-key path exists. |
13+
| `@corbits/xai-provider` | Grok through the grok CLI OAuth login. Those tokens only work on the CLI chat proxy. |
14+
| `@corbits/ollama-adapter` | Local or cloud Ollama over `/v1/chat/completions` or `/v1/messages`. |
15+
| `@corbits/oauth-core` | PKCE plus loopback OAuth login, token refresh, and hub login routes. |
16+
| `@corbits/credential-http` | Origin-pinned credentials for any header (x-api-key, raw authorization, MCP). |
17+
18+
Codex and xAI are built on `openai-responses` and `oauth-core`. Codex depends on the ChatGPT backend and is the most fragile.
19+
20+
## Wire an adapter in process
21+
22+
```ts
23+
import { createDependencies, runInference } from "@intx/inference";
24+
import {
25+
createOpenAIResponsesAdapter,
26+
OPENAI_RESPONSES_PROVIDER,
27+
} from "@corbits/openai-responses";
28+
29+
const deps = createDependencies({
30+
has: (p) => p === OPENAI_RESPONSES_PROVIDER,
31+
resolve: (source, quirks) => createOpenAIResponsesAdapter(source, quirks),
32+
});
33+
const source = {
34+
id: "openai",
35+
provider: OPENAI_RESPONSES_PROVIDER,
36+
baseURL: "https://api.openai.com/v1",
37+
credentialId: "OPENAI_API_KEY",
38+
model: "gpt-5-mini",
39+
};
40+
// runInference({ deps, source, turns, nextSeq, readMaterial: (id) => ({ secret: process.env[id]! }) })
41+
```
42+
43+
## Wire an adapter in a sidecar
44+
45+
```bash
46+
SIDECAR_ADAPTER_MANIFEST='[{"provider":"ollama","specifier":"@corbits/ollama-adapter","export":"createOllamaAdapter"}]'
47+
```
48+
49+
The hub forwards this variable to sidecars it spawns. Codex uses `createCodexResponsesAdapter` with provider id `codex`. Ollama on `/v1/messages` uses the export `createOllamaAnthropicAdapter`.
50+
51+
## Per-package notes
52+
53+
- **Codex:** name your host with `CodexQuirks { productName, environmentTagName }`. Pass the account id as `providerOptions[CODEX_ACCOUNT_ID_OPTION]`. `createDependencies` binds global fetch, so build deps by hand to install `withCodexContentTypeRepair`.
54+
- **xAI:** for API keys use `XAI_API_KEY_BASE_URL` (`https://api.x.ai/v1`). For the OAuth login use `XAI_OAUTH_PROXY_BASE_URL` and pass the user id option.
55+
- **Ollama:** set `reasoning` per model in mixed fleets (Ollama rejects `reasoning_effort` on non-reasoning models). It ignores `num_ctx` on `/v1`, so start the server with `OLLAMA_CONTEXT_LENGTH`.
56+
- **oauth-core:** `loginWithProvider(...)` for CLIs. On the hub, `mountOAuthLogin` and `createOAuthTokenRefresher` from `@corbits/oauth-core/hub`. A provider is `{ oauthConfig, exchange, refresh }`, supplied by a package like codex or xai.
57+
- **Peer ranges:** codex and xai currently peer on `oauth-core@^0.2.0` and `openai-responses@^0.2.0`, but oauth-core is 0.3.0. Check peer warnings before installing them together.
58+
59+
## Need more
60+
61+
- Typed decisions instead of chat (routing, gating): `use_skill corbits-system-one`.
62+
- MCP servers and their credentials: `use_skill corbits-tools`.
63+
- How sources and failover work in an agent: `use_skill interchange-agents`.
64+
- Catalog: `use_skill corbits`.

0 commit comments

Comments
 (0)