From a2a8c23183c91cfbb1b44c4591b735cdc3bb3a99 Mon Sep 17 00:00:00 2001 From: Artur Do Lago Date: Fri, 9 Jan 2026 13:36:12 +0100 Subject: [PATCH] feat: replace built-in agents with Personas triad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove hardcoded build/plan/general/explore agents from source - Add Zee, Stanley, Johny agent definitions in .opencode/agent/ - Remove upstream docs/duplicate-pr/triage agents - Update CLAUDE.md with agent-core → tiara → personas architecture - Configure Cerebras as default model for all agents (fast instruct) - Set small_model for internal agents (title, compaction) The Personas system now provides all agent functionality through the triad, with shared orchestration via tiara. Co-Authored-By: Claude Opus 4.5 --- .opencode/agent/docs.md | 34 --------- .opencode/agent/duplicate-pr.md | 26 ------- .opencode/agent/johny.md | 11 +++ .opencode/agent/stanley.md | 11 +++ .opencode/agent/triage.md | 78 ------------------- .opencode/agent/zee.md | 11 +++ .opencode/opencode.jsonc | 11 +-- CLAUDE.md | 109 +++++++++++++++++++++------ packages/opencode/src/agent/agent.ts | 80 ++------------------ 9 files changed, 126 insertions(+), 245 deletions(-) delete mode 100644 .opencode/agent/docs.md delete mode 100644 .opencode/agent/duplicate-pr.md create mode 100644 .opencode/agent/johny.md create mode 100644 .opencode/agent/stanley.md delete mode 100644 .opencode/agent/triage.md create mode 100644 .opencode/agent/zee.md diff --git a/.opencode/agent/docs.md b/.opencode/agent/docs.md deleted file mode 100644 index 21cfc6a16e0..00000000000 --- a/.opencode/agent/docs.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: ALWAYS use this when writing docs -color: "#38A3EE" ---- - -You are an expert technical documentation writer - -You are not verbose - -Use a relaxed and friendly tone - -The title of the page should be a word or a 2-3 word phrase - -The description should be one short line, should not start with "The", should -avoid repeating the title of the page, should be 5-10 words long - -Chunks of text should not be more than 2 sentences long - -Each section is separated by a divider of 3 dashes - -The section titles are short with only the first letter of the word capitalized - -The section titles are in the imperative mood - -The section titles should not repeat the term used in the page title, for -example, if the page title is "Models", avoid using a section title like "Add -new models". This might be unavoidable in some cases, but try to avoid it. - -Check out the /packages/web/src/content/docs/docs/index.mdx as an example. - -For JS or TS code snippets remove trailing semicolons and any trailing commas -that might not be needed. - -If you are making a commit prefix the commit message with `docs:` diff --git a/.opencode/agent/duplicate-pr.md b/.opencode/agent/duplicate-pr.md deleted file mode 100644 index c9c932ef790..00000000000 --- a/.opencode/agent/duplicate-pr.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -mode: primary -hidden: true -model: opencode/claude-haiku-4-5 -color: "#E67E22" -tools: - "*": false - "github-pr-search": true ---- - -You are a duplicate PR detection agent. When a PR is opened, your job is to search for potentially duplicate or related open PRs. - -Use the github-pr-search tool to search for PRs that might be addressing the same issue or feature. - -IMPORTANT: The input will contain a line `CURRENT_PR_NUMBER: NNNN`. This is the current PR number, you should not mark that the current PR as a duplicate of itself. - -Search using keywords from the PR title and description. Try multiple searches with different relevant terms. - -If you find potential duplicates: - -- List them with their titles and URLs -- Briefly explain why they might be related - -If no duplicates are found, say so clearly. BUT ONLY SAY "No duplicate PRs found" (don't say anything else if no dups) - -Keep your response concise and actionable. diff --git a/.opencode/agent/johny.md b/.opencode/agent/johny.md new file mode 100644 index 00000000000..82122f70f18 --- /dev/null +++ b/.opencode/agent/johny.md @@ -0,0 +1,11 @@ +--- +description: Learning system - study, knowledge graph, spaced repetition +color: "#c4f042" +includes: + - johny + - personas + - shared + - agents-menu +--- + +{skill:johny} diff --git a/.opencode/agent/stanley.md b/.opencode/agent/stanley.md new file mode 100644 index 00000000000..ef19268be0f --- /dev/null +++ b/.opencode/agent/stanley.md @@ -0,0 +1,11 @@ +--- +description: Investing system - markets, portfolio, SEC filings, NautilusTrader +color: "#ffcb47" +includes: + - stanley + - personas + - shared + - agents-menu +--- + +{skill:stanley} diff --git a/.opencode/agent/triage.md b/.opencode/agent/triage.md deleted file mode 100644 index 539be154917..00000000000 --- a/.opencode/agent/triage.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -mode: primary -hidden: true -model: opencode/claude-haiku-4-5 -color: "#44BA81" -tools: - "*": false - "github-triage": true ---- - -You are a triage agent responsible for triaging github issues. - -Use your github-triage tool to triage issues. - -## Labels - -### windows - -Use for any issue that mentions Windows (the OS). Be sure they are saying that they are on Windows. - -- Use if they mention WSL too - -#### perf - -Performance-related issues: - -- Slow performance -- High RAM usage -- High CPU usage - -**Only** add if it's likely a RAM or CPU issue. **Do not** add for LLM slowness. - -#### desktop - -Desktop app issues: - -- `opencode web` command -- The desktop app itself - -**Only** add if it's specifically about the Desktop application or `opencode web` view. **Do not** add for terminal, TUI, or general opencode issues. - -#### nix - -**Only** add if the issue explicitly mentions nix. - -#### zen - -**Only** add if the issue mentions "zen" or "opencode zen". Zen is our gateway for coding models. **Do not** add for other gateways or inference providers. - -If the issue doesn't have "zen" in it then don't add zen label - -#### docs - -Add if the issue requests better documentation or docs updates. - -#### opentui - -TUI issues potentially caused by our underlying TUI library: - -- Keybindings not working -- Scroll speed issues (too fast/slow/laggy) -- Screen flickering -- Crashes with opentui in the log - -**Do not** add for general TUI bugs. - -When assigning to people here are the following rules: - -adamdotdev: -ONLY assign adam if the issue will have the "desktop" label. - -fwang: -ONLY assign fwang if the issue will have the "zen" label. - -jayair: -ONLY assign jayair if the issue will have the "docs" label. - -In all other cases use best judgment. Avoid assigning to kommander needlessly, when in doubt assign to rekram1-node. diff --git a/.opencode/agent/zee.md b/.opencode/agent/zee.md new file mode 100644 index 00000000000..464dc8c9ddd --- /dev/null +++ b/.opencode/agent/zee.md @@ -0,0 +1,11 @@ +--- +description: Personal life assistant - memory, messaging, calendar, contacts +color: "#8ae8ff" +includes: + - zee + - personas + - shared + - agents-menu +--- + +{skill:zee} diff --git a/.opencode/opencode.jsonc b/.opencode/opencode.jsonc index 5d2dec625c6..7c10cb96e49 100644 --- a/.opencode/opencode.jsonc +++ b/.opencode/opencode.jsonc @@ -1,15 +1,8 @@ { "$schema": "https://opencode.ai/config.json", - // "plugin": ["opencode-openai-codex-auth"], - // "enterprise": { - // "url": "https://enterprise.dev.opencode.ai", - // }, + "model": "cerebras/qwen-3-235b-a22b-instruct-2507", + "small_model": "cerebras/gpt-oss-120b", "instructions": ["STYLE_GUIDE.md"], - "provider": { - "opencode": { - "options": {}, - }, - }, "mcp": { "context7": { "type": "remote", diff --git a/CLAUDE.md b/CLAUDE.md index e9832b3d9ab..e0742036543 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,6 +1,24 @@ # Agent-Core - The Engine -This is the **engine** that powers Artur's Agent System. OpenCode is the **surface** (car), agent-core is the **engine + custom parts**. +This is the **engine** that powers Artur's Agent System. agent-core is a fork of OpenCode with custom personas. + +## IMPORTANT: First Steps When Working on This Repo + +**ALWAYS read these before making changes:** + +1. **Tiara** (`vendor/tiara/`) - The orchestration submodule with claude-flow + - `vendor/tiara/CLAUDE.md` - SPARC methodology, concurrent execution rules + - `vendor/tiara/docs/` - Architecture, integrations, roadmaps + +2. **The Triad** (`.claude/skills/`) - The three personas: + - `.claude/skills/zee/SKILL.md` - Personal assistant (memory, messaging, calendar) + - `.claude/skills/stanley/SKILL.md` - Investing system (markets, portfolio, NautilusTrader) + - `.claude/skills/johny/SKILL.md` - Learning system (knowledge graph, spaced repetition) + +3. **Shared capabilities** (`.claude/skills/shared/`, `.claude/skills/personas/`) + - Orchestration, WezTerm integration, drone spawning + +**Do NOT skip this step** - the personas have specific capabilities and delegation rules. ## The Personas System @@ -82,29 +100,68 @@ You can always check: - Memory search results ``` -## Architecture +## Architecture: agent-core → tiara → personas ``` -┌─────────────────────────────────────────────────────────────┐ -│ OPENCODE (Surface) │ -│ ~/.config/opencode/ - TUI, auth, plugins │ -└─────────────────────────────────────────────────────────────┘ - │ - │ symlinks to - ▼ -┌─────────────────────────────────────────────────────────────┐ -│ AGENT-CORE (Engine) │ -│ ~/Repositories/agent-core/ │ -│ │ -│ .claude/skills/ ← Personas (Johny, Stanley, Zee) │ -│ src/domain/ ← Domain tools │ -│ src/personas/ ← Knowledge graph, trading logic │ -│ src/council/ ← LLM Council multi-model deliberation │ -│ src/memory/ ← Qdrant vector storage │ -│ src/personas/ ← Personas orchestration system │ -└─────────────────────────────────────────────────────────────┘ +┌─────────────────────────────────────────────────────────────────────┐ +│ AGENT-CORE (Engine) │ +│ ~/Repositories/agent-core/ │ +│ │ +│ packages/opencode/ ← Fork of OpenCode TUI (built-in agents │ +│ removed, only triad remains) │ +│ ~/.config/agent-core/ ← Config, auth, plugins │ +├─────────────────────────────────────────────────────────────────────┤ +│ │ │ +│ ▼ │ +│ ┌───────────────────────────────────────────────────────────────┐ │ +│ │ TIARA (Orchestration) │ │ +│ │ vendor/tiara/ │ │ +│ │ │ │ +│ │ • SPARC methodology (Specification→Pseudocode→Architecture │ │ +│ │ →Refinement→Completion) │ │ +│ │ • Claude-Flow swarm coordination │ │ +│ │ • Concurrent execution patterns │ │ +│ │ • Agent spawning via Task tool │ │ +│ │ • Memory coordination │ │ +│ └───────────────────────────────────────────────────────────────┘ │ +│ │ │ +│ ▼ │ +│ ┌───────────────────────────────────────────────────────────────┐ │ +│ │ PERSONAS (The Triad) │ │ +│ │ .claude/skills/ │ │ +│ │ │ │ +│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ +│ │ │ ZEE │ │ STANLEY │ │ JOHNY │ │ │ +│ │ │ Personal│ │Investing│ │Learning │ │ │ +│ │ └────┬────┘ └────┬────┘ └────┬────┘ │ │ +│ │ └───────────────┼───────────────┘ │ │ +│ │ ▼ │ │ +│ │ ┌─────────────────┐ │ │ +│ │ │ SHARED LAYER │ │ │ +│ │ │ • personas/ │ Orchestration, drones │ │ +│ │ │ • shared/ │ Qdrant, WezTerm, canvas │ │ +│ │ │ • agents-menu/ │ Delegation routing │ │ +│ │ └─────────────────┘ │ │ +│ └───────────────────────────────────────────────────────────────┘ │ +│ │ +│ src/ │ +│ ├── domain/ ← Domain tools (stanley/, zee/) │ +│ ├── personas/ ← Persona logic (knowledge-graph, etc.) │ +│ ├── council/ ← LLM Council multi-model deliberation │ +│ └── memory/ ← Qdrant vector storage types │ +└─────────────────────────────────────────────────────────────────────┘ ``` +### Flow Summary + +1. **agent-core** = Fork of OpenCode with built-in agents (build/plan/general/explore) **removed** +2. **tiara** = Orchestration layer providing SPARC methodology and swarm coordination +3. **personas** = The Triad (Zee/Stanley/Johny) + shared capabilities + +### Key Principle + +No generic "build" or "plan" agents. Every interaction goes through a persona with domain expertise. The personas share orchestration (tiara) and memory (Qdrant) but have distinct purposes. + ## Personas | Persona | Inspiration | Domain | Skills Location | @@ -134,13 +191,15 @@ agent-core/ └── SKILLS.md # Skills documentation ``` -## Integration with OpenCode +## Integration -Skills are symlinked globally: +Skills are loaded from `.claude/skills/` and `~/.config/agent-core/skills/`: ``` -~/.config/opencode/skills/johny → agent-core/.claude/skills/johny -~/.config/opencode/skills/stanley → agent-core/.claude/skills/stanley -~/.config/opencode/skills/zee → agent-core/.claude/skills/zee +.claude/skills/johny/ → Johny persona +.claude/skills/stanley/ → Stanley persona +.claude/skills/zee/ → Zee persona +.claude/skills/personas/ → Shared orchestration +.claude/skills/shared/ → Shared tools (Qdrant, WezTerm, canvas) ``` ## Development Guidelines diff --git a/packages/opencode/src/agent/agent.ts b/packages/opencode/src/agent/agent.ts index ab17dd2235c..4a72a3eaa5e 100644 --- a/packages/opencode/src/agent/agent.ts +++ b/packages/opencode/src/agent/agent.ts @@ -8,9 +8,9 @@ import { Truncate } from "../tool/truncation" import PROMPT_GENERATE from "./generate.txt" import PROMPT_COMPACTION from "./prompt/compaction.txt" -import PROMPT_EXPLORE from "./prompt/explore.txt" import PROMPT_SUMMARY from "./prompt/summary.txt" import PROMPT_TITLE from "./prompt/title.txt" +// NOTE: PROMPT_EXPLORE removed - explore agent replaced by Personas system import { PermissionNext } from "@/permission/next" import { mergeDeep, pipe, sortBy, values } from "remeda" @@ -62,78 +62,11 @@ export namespace Agent { }) const user = PermissionNext.fromConfig(cfg.permission ?? {}) + // NOTE: Built-in agents (build, plan, general, explore) removed. + // agent-core uses the Personas system (Zee, Stanley, Johny) defined in .claude/skills/ + // Custom agents are loaded from config and skill files. const result: Record = { - build: { - name: "build", - options: {}, - permission: PermissionNext.merge( - defaults, - PermissionNext.fromConfig({ - question: "allow", - }), - user, - ), - mode: "primary", - native: true, - }, - plan: { - name: "plan", - options: {}, - permission: PermissionNext.merge( - defaults, - PermissionNext.fromConfig({ - question: "allow", - edit: { - "*": "deny", - ".opencode/plan/*.md": "allow", - }, - }), - user, - ), - mode: "primary", - native: true, - }, - general: { - name: "general", - description: `General-purpose agent for researching complex questions and executing multi-step tasks. Use this agent to execute multiple units of work in parallel.`, - permission: PermissionNext.merge( - defaults, - PermissionNext.fromConfig({ - todoread: "deny", - todowrite: "deny", - }), - user, - ), - options: {}, - mode: "subagent", - native: true, - }, - explore: { - name: "explore", - permission: PermissionNext.merge( - defaults, - PermissionNext.fromConfig({ - "*": "deny", - grep: "allow", - glob: "allow", - list: "allow", - bash: "allow", - webfetch: "allow", - websearch: "allow", - codesearch: "allow", - read: "allow", - external_directory: { - [Truncate.DIR]: "allow", - }, - }), - user, - ), - description: `Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.`, - prompt: PROMPT_EXPLORE, - options: {}, - mode: "subagent", - native: true, - }, + // Internal system agents - required for core functionality compaction: { name: "compaction", mode: "primary", @@ -221,7 +154,8 @@ export namespace Agent { return pipe( await state(), values(), - sortBy([(x) => (cfg.default_agent ? x.name === cfg.default_agent : x.name === "build"), "desc"]), + // Sort by default_agent config, no hardcoded fallback + sortBy([(x) => (cfg.default_agent ? x.name === cfg.default_agent : false), "desc"]), ) }