From 790e8b6041d89e19fc55a43cc2e9cc3b15c74959 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Mon, 20 Jul 2026 13:55:59 -0700 Subject: [PATCH] Fold the default-agents package into the agent module The separate workspace package existed so plugin authors could import the agent profile types, but agent plugins and local profiles are data validated at load time, so nothing outside the repo imports them. The profile contract and the built-in greybeard and critique profiles now live in the agent module, and the workspace has a single first-party package. --- README.md | 2 +- bun.lock | 7 ------- package.json | 4 +--- packages/agents/package.json | 12 ------------ packages/agents/tsconfig.json | 4 ---- .../index.ts => src/agent/default-agents.ts | 15 ++------------- .../src/types.ts => src/agent/profile-types.ts | 18 +++++++++--------- src/agent/profiles.ts | 12 ++++-------- src/config/settings.ts | 2 +- src/plugins/data-only-agent.ts | 2 +- src/provider/reasoning-effort.ts | 8 ++++---- tests/unit/resolve-inference-spec.test.ts | 2 +- 12 files changed, 24 insertions(+), 64 deletions(-) delete mode 100644 packages/agents/package.json delete mode 100644 packages/agents/tsconfig.json rename packages/agents/src/index.ts => src/agent/default-agents.ts (82%) rename packages/agents/src/types.ts => src/agent/profile-types.ts (82%) diff --git a/README.md b/README.md index a2b81fa3..49cee73b 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Intercode keeps repository guidance and sub-agent profiles separate: - `AGENTS.md` — shared startup instructions and project context - `CLAUDE.md` — Claude-specific workspace notes -- `packages/agents/` — built-in sub-agent profiles shipped with Intercode (`greybeard`, `critique`) +- `src/agent/default-agents.ts` — built-in sub-agent profiles shipped with Intercode (`greybeard`, `critique`) - `.agents/agents/` — optional local profile overrides or additions; this directory is not required and may be absent Named `task` sub-agents resolve from built-ins first, then enabled agent plugins, then local `.agents/agents/*.json|*.yaml` profiles. Add a local profile under `.agents/agents/` or use an installed profile id such as `greybeard`. diff --git a/bun.lock b/bun.lock index 5ce1425c..dc951bd8 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,6 @@ "": { "name": "interchange-code", "dependencies": { - "@intercode/default-agents": "workspace:*", "@intx/agent": "workspace:*", "@intx/inference": "workspace:*", "@intx/log": "workspace:*", @@ -139,10 +138,6 @@ "@types/semver": "catalog:", }, }, - "packages/agents": { - "name": "@intercode/default-agents", - "version": "0.1.0", - }, "vendor/intx-inference": { "name": "@intx/inference", "version": "0.1.2", @@ -176,8 +171,6 @@ "@hono/node-server": ["@hono/node-server@1.19.14", "", { "peerDependencies": { "hono": "^4" } }, "sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw=="], - "@intercode/default-agents": ["@intercode/default-agents@workspace:packages/agents"], - "@intx/agent": ["@intx/agent@workspace:interchange/packages/agent"], "@intx/crypto-node": ["@intx/crypto-node@workspace:interchange/packages/crypto-node"], diff --git a/package.json b/package.json index 163d115d..27a5da9e 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "./interchange/packages/mime", "./interchange/packages/log", "./interchange/packages/crypto-node", - "./interchange/packages/tools-lsp", - "./packages/agents" + "./interchange/packages/tools-lsp" ], "catalog": { "@types/semver": "^7.7.1", @@ -42,7 +41,6 @@ "tar": "^7.5.1" }, "dependencies": { - "@intercode/default-agents": "workspace:*", "@intx/agent": "workspace:*", "@intx/inference": "workspace:*", "@intx/log": "workspace:*", diff --git a/packages/agents/package.json b/packages/agents/package.json deleted file mode 100644 index 9c6a223d..00000000 --- a/packages/agents/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@intercode/default-agents", - "version": "0.1.0", - "private": true, - "type": "module", - "exports": { - ".": { - "types": "./src/index.ts", - "default": "./src/index.ts" - } - } -} diff --git a/packages/agents/tsconfig.json b/packages/agents/tsconfig.json deleted file mode 100644 index 8670e092..00000000 --- a/packages/agents/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../interchange/tsconfig.base.json", - "include": ["src/**/*.ts"] -} diff --git a/packages/agents/src/index.ts b/src/agent/default-agents.ts similarity index 82% rename from packages/agents/src/index.ts rename to src/agent/default-agents.ts index 35d2442d..bf04a402 100644 --- a/packages/agents/src/index.ts +++ b/src/agent/default-agents.ts @@ -1,20 +1,9 @@ -export type { - AgentProfile, - AgentPlugin, - CapabilityFilter, - CapabilityMode, - InferenceLeg, - InferenceSpec, - ReasoningEffort, -} from "./types.js"; -export { REASONING_EFFORTS } from "./types.js"; - -import type { AgentPlugin } from "./types.js"; +import type { AgentPlugin } from "./profile-types.js"; // Default agent profiles shipped with intercode. These are the sub-agents // referenced by the built-in workflows. Repositories can override any of // these by placing a same-id profile in .agents/agents/. -export const plugin: AgentPlugin = { +export const defaultAgentsPlugin: AgentPlugin = { agents: [ { id: "greybeard", diff --git a/packages/agents/src/types.ts b/src/agent/profile-types.ts similarity index 82% rename from packages/agents/src/types.ts rename to src/agent/profile-types.ts index 206ff9e9..3705b4fd 100644 --- a/packages/agents/src/types.ts +++ b/src/agent/profile-types.ts @@ -1,12 +1,13 @@ -// Public contract for agent plugin authors. +// Agent profile contract. External profiles are data (JSON/YAML under +// .agents/agents/ or contributed by agent-kind plugins) validated against +// this shape at load time; these types never cross the repo boundary. // Reasoning-effort levels carried through to the provider. The canonical -// definition lives here so plugin authors and runtime stay in sync without -// re-declaring the literal set. Mirrored as a runtime array by -// src/provider/reasoning-effort.ts. Ordered from least to most effort; "ultra" -// is not simply a bigger thinking budget than "max" — it additionally enables -// automatic sub-task delegation, so code that treats effort as a scalar dial -// may need to branch on it separately. +// definition lives here; src/provider/reasoning-effort.ts mirrors it as the +// runtime array. Ordered from least to most effort; "ultra" is not simply a +// bigger thinking budget than "max" — it additionally enables automatic +// sub-task delegation, so code that treats effort as a scalar dial may need +// to branch on it separately. export const REASONING_EFFORTS = [ "none", "minimal", @@ -76,8 +77,7 @@ export type AgentProfile = { maxTurns?: number; }; -// The shape every agent plugin package must export as "plugin" or as the -// default export. +// The shape an agent-kind plugin contributes: a list of profiles. export type AgentPlugin = { agents: AgentProfile[]; }; diff --git a/src/agent/profiles.ts b/src/agent/profiles.ts index ab7f8254..8237dc88 100644 --- a/src/agent/profiles.ts +++ b/src/agent/profiles.ts @@ -3,15 +3,11 @@ import { join } from "node:path"; import { type } from "arktype"; -import { - plugin as defaultPlugin, - REASONING_EFFORTS, -} from "@intercode/default-agents"; +import { defaultAgentsPlugin as defaultPlugin } from "./default-agents.js"; +import { REASONING_EFFORTS } from "./profile-types.js"; -// Public agent profile types live in @intercode/default-agents so plugin -// authors can depend on that package without pulling in the full runtime. -export type { AgentProfile, AgentPlugin, CapabilityFilter, CapabilityMode, InferenceLeg, InferenceSpec, ReasoningEffort } from "@intercode/default-agents"; -import type { AgentProfile } from "@intercode/default-agents"; +export type { AgentProfile, AgentPlugin, CapabilityFilter, CapabilityMode, InferenceLeg, InferenceSpec, ReasoningEffort } from "./profile-types.js"; +import type { AgentProfile } from "./profile-types.js"; // Exported so agent-kind plugins can validate contributed profiles. export { AgentProfileSchema }; diff --git a/src/config/settings.ts b/src/config/settings.ts index cb50805e..de8227f4 100644 --- a/src/config/settings.ts +++ b/src/config/settings.ts @@ -717,7 +717,7 @@ export function resolveTier(tier: ProviderTier, settings: Settings): TierAssignm }; } -import type { InferenceSpec } from "@intercode/default-agents"; +import type { InferenceSpec } from "../agent/profile-types.js"; // A resolved inference leg, with reasoningEffort threaded through. export type ResolvedInference = { diff --git a/src/plugins/data-only-agent.ts b/src/plugins/data-only-agent.ts index 6edd4f85..534eb552 100644 --- a/src/plugins/data-only-agent.ts +++ b/src/plugins/data-only-agent.ts @@ -8,7 +8,7 @@ import type { ReasoningEffort, } from "../agent/profiles.js"; import { AgentProfileSchema } from "../agent/profiles.js"; -import { REASONING_EFFORTS } from "@intercode/default-agents"; +import { REASONING_EFFORTS } from "../agent/profile-types.js"; import { splitFrontmatter } from "./frontmatter.js"; import { type } from "arktype"; diff --git a/src/provider/reasoning-effort.ts b/src/provider/reasoning-effort.ts index a10da597..74967e38 100644 --- a/src/provider/reasoning-effort.ts +++ b/src/provider/reasoning-effort.ts @@ -3,10 +3,10 @@ // "variant" or a separate model — the same model accepts an effort level that // trades latency and cost against reasoning depth. -// The canonical literal set lives in @intercode/default-agents so plugin -// authors and the runtime cannot drift. Re-exported here for callers that -// already import from this module. -import { REASONING_EFFORTS as CANONICAL_EFFORTS } from "@intercode/default-agents"; +// The canonical literal set lives in the agent profile contract so the +// profile schema and the runtime cannot drift. Re-exported here for callers +// that already import from this module. +import { REASONING_EFFORTS as CANONICAL_EFFORTS } from "../agent/profile-types.js"; export const REASONING_EFFORTS = CANONICAL_EFFORTS; export type ReasoningEffort = (typeof REASONING_EFFORTS)[number]; diff --git a/tests/unit/resolve-inference-spec.test.ts b/tests/unit/resolve-inference-spec.test.ts index cc65a752..d8a60c49 100644 --- a/tests/unit/resolve-inference-spec.test.ts +++ b/tests/unit/resolve-inference-spec.test.ts @@ -4,7 +4,7 @@ import { resolveInferenceWithPolicy, type Settings, } from "../../src/config/settings.js"; -import type { InferenceSpec } from "@intercode/default-agents"; +import type { InferenceSpec } from "../../src/agent/profile-types.js"; const baseSettings: Settings = { providers: {