mirror of
https://github.com/gnekt/My-Brain-Is-Full-Crew.git
synced 2026-08-30 20:15:39 +00:00
* Fix istall/update scripts * test: capture pre-refactor install snapshot for regression Adds take-snapshot.sh script and the resulting snapshot/ directory, capturing the exact vault state produced by launchme.sh before the framework-agnosticity refactor begins. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Summary: Refactor agents/skills/hooks/mcp in agentic-platform-agnostic templates. refactor: rename source CLAUDE.md → DISPATCHER.md (framework-neutral) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> refactor: convert agent frontmatter from tools: to neutral capabilities: Replace Claude Code-specific `tools:` frontmatter with framework-agnostic `mode: subagent` and `capabilities: [...]` in all 8 agent files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> refactor: add neutral hook trigger manifests (.hook.yaml) refactor: hooks read neutral JSON schema (args.* instead of tool_input.*) refactor: convert .mcp.json to neutral mcp/servers.yaml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement agentic-platform adapters skeleton. build: add adapters/lib.sh skeleton with vocabulary constants test: bash test runner for adapter helpers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): parse_frontmatter helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): parse_capabilities helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): should_include helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): parse_hook_yaml helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): agent_body helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): enumerate_agents and enumerate_hooks helpers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement agentic-platform adapter for Claude Code. build(adapters): claude-code adapter skeleton with capability/event tables build(claude-code): adapter_translate_dispatcher with test build(claude-code): adapter_translate_references with test build(claude-code): adapter_translate_skills with tests build(claude-code): adapter_translate_agents with capability→tools mapping build(claude-code): hook wrapper template (CC native → neutral schema) build(claude-code): adapter_translate_hooks with wrapper generation build(claude-code): adapter_translate_mcp with hand-rolled YAML parser build(claude-code): adapter_finalize and complete adapter_build wiring build: scripts/build.sh dispatches to per-framework adapter Also fix adapter_translate_hooks and adapter_translate_agents to use while-read loops (avoiding word-splitting on paths with spaces) and guard grep calls with || true to survive set -eo pipefail when hooks have no match-tool field. Remove scripts/build.sh from .gitignore. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Refactor install/update scripts to support agentic-platform agnosticity. refactor(lib.sh): generalize install_claude_md → install_dispatcher New signature takes the full destination path instead of just the vault dir, allowing callers to install CLAUDE.md, AGENTS.md, or any dispatcher file to an explicit location. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(launchme): support --framework flag, build dist/ before install Add --framework and --target arg parsing. Run build.sh before installing to populate dist/<framework>/. All install_* calls now read from dist/<framework>/ instead of the raw source dirs. MCP is now handled automatically by the adapter (no interactive prompt). Replaced install_claude_md with install_dispatcher. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(updateme): support --framework flag, build dist/ before update Add --framework and --target arg parsing. Run build.sh before installing to populate dist/<framework>/. All install_* calls now read from dist/<framework>/ instead of raw source dirs. Replaced install_claude_md with install_dispatcher. Also fix set -e compatibility in lib.sh: add || true to all conditional [[ ... ]] && info "..." logging lines so they don't abort the script when VERBOSE_COPY=0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: regression runner diffs dist/claude-code against pre-refactor snapshot - Add tests/regression/run.sh that builds dist/claude-code and compares against snapshot, excluding runtime-only artifacts (.mbifc-manifest, .mcp.json, .claude-plugin/plugin.json) - Fix adapters/lib.sh agent_body: preserve '---' section dividers in body (awk now only skips '---' while still inside frontmatter, fm < 2) - Fix adapters/claude-code/adapter.sh: change 'read' capability to expand to only 'Read', appending 'Glob, Grep' at end of tools list to match snapshot ordering - Update snapshot to reflect intentional refactor changes: hook JSON schema (.args.* instead of .tool_input.*), wrapper scripts, settings.json with wrapper paths, and consistent tool ordering for postman/sorter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement opencode adapter. Co-Authored-By: win0na <winnie@winneon.moe> feat(lib.sh): add install_plugins helper for opencode JS plugins build(adapters): opencode adapter skeleton with capability/event tables build(opencode): adapter_translate_dispatcher (DISPATCHER.md → AGENTS.md) build(opencode): adapter_translate_references and adapter_translate_skills Implements Task 4 and Task 5: - adapter_translate_references: Copies reference markdown files to .opencode/references/ - adapter_translate_skills: Copies skill SKILL.md files to .opencode/skills/<name>/ with exclude filtering Both functions respect framework filtering via should_include(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): adapter_translate_agents with capability→permission mapping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): bash-executor template for spawning hook scripts build(opencode): plugin-stub template for mbifc-hooks.js build(opencode): adapter_translate_hooks with JS plugin generation Implements _oc_hook_registry_json and adapter_translate_hooks in the opencode adapter. Copies hook scripts to .opencode/hooks/, generates a single .opencode/plugins/mbifc-hooks.js by inlining bash-executor.js and synthesising a hook registry from *.hook.yaml files. Uses python3 for template substitution to safely handle multi-line JS content. Adds 3 unit tests (copies scripts, registry entries, noop when no hooks dir). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): adapter_translate_mcp with local/remote handling build(opencode): adapter_finalize and complete adapter_build wiring Add adapter_finalize placeholder and wire adapter_translate_mcp into adapter_build; add end-to-end integration test (14/14 pass). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(launchme): branch on --framework for opencode install layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(updateme): branch on --framework for opencode install layout Mirror the same case "$FRAMEWORK" block from launchme.sh: framework-specific DIST_COMPONENTS_DIR, VAULT_COMPONENTS_DIR, DISPATCHER_SRC/DST, MCP_SRC/DST, HAS_PLUGINS; conditional install_plugins; conditional install_settings; framework-aware vault-setup check; framework-neutral summary messages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix adapters to follow the same template. fix: restore adapter_build() contract, revert function renames Both adapters now export adapter_build() and adapter_translate_*() as the uniform public contract. scripts/build.sh sources one adapter and calls adapter_build uniformly. Private helpers (_oc_*) and vocabulary tables (cc_capability_to_tools, oc_capability_to_permission, etc.) retain their prefixes. CC regression and OC unit tests all pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> fix(tests): restore test_oc_ prefix on adapter_build end-to-end test * Fix agent format in opencode adapter * refactor: rename --framework to --platform across all scripts and tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Modify generic name for model tiers Co-Authored-By: win0na <winnie@winneon.moe> refactor: neutral model vocabulary (low/mid/high) in source agents feat(claude-code): cc_model_to_native() maps low/mid/high to haiku/sonnet/opus Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(opencode): update oc_model_to_provider() for low/mid/high vocabulary Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add gemini-cli adapter Co-Authored-By: win0na <winnie@winneon.moe> build(gemini-cli): adapter skeleton with capability/event/model tables build(gemini-cli): adapter_translate_dispatcher (DISPATCHER.md → GEMINI.md) build(gemini-cli): adapter_translate_references and adapter_translate_skills Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(gemini-cli): adapter_translate_agents with capability→tools mapping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(gemini-cli): adapter_translate_hooks with wrapper scripts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> feat(install): add gemini-cli platform to launchme.sh and updateme.sh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement preserving config merge for opencode. Co-Authored-By: win0na <winnie@winneon.moe> feat(opencode): config-merge.sh with formatting-preserving JSON merge Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): source config-merge.sh from adapter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(install): use oc_config_merge for opencode.json instead of overwrite Source config-merge.sh from install scripts for opencode platform so user keys in opencode.json are preserved on reinstall and update. Fix in-place merge by writing to a temp file before moving to output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add mcp files to gitignore. * Fix claude-specific references in agents, skills and references * Fix: remove claude-specific reference from hooks. build: add platform_dir and dispatcher_name to all hook wrapper/plugin templates feat(hooks): platform-aware path checks using platform_dir and dispatcher_name from JSON input test: update regression snapshot for platform-aware hook wrappers and scripts * Added interactive platform choice in launchme, and platform auto-detection in updateme. * Fix: remove claude-specific references from documentation * Update documentation to reflect the new platform-agnostic architecture * fix: address Copilot review feedback on PR #32 - tests/run.sh: check source return code, report failures - tests/regression/run.sh: use mktemp + trap cleanup instead of fixed /tmp paths - tests/regression/run.sh: include .mcp.json in regression comparison - tests/regression/take-snapshot.sh: use --platform flag instead of stale scripted input - adapters/opencode/templates/plugin-stub.js.tmpl: include stdout in hook block error message * fix: address Copilot review round 2 - config-merge.sh: reword comment to only promise indentation preservation (not full formatting) - take-snapshot.sh: copy required artifacts explicitly, optional ones with existence check - adapters/lib.sh: document parse_hook_yaml single-trigger limitation * fix: address Copilot review round 3 - adapters/opencode/adapter.sh: replace python3 template substitution with pure bash (while-read loop with case matching), removing python3 dependency - adapters/lib.sh: should_include now falls back to plain YAML key read for files without frontmatter delimiters (fixes hook .yaml exclude: support) * fix: address Copilot review round 4 - scripts/launchme.sh: fix double-dot in FW_DIR_NAME display (basename already includes the dot, e.g. ".claude") - scripts/launchme.sh: replace undefined MCP_ANSWER with check on MCP_DST existence for summary banner --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
217 lines
9.3 KiB
Markdown
Executable File
217 lines
9.3 KiB
Markdown
Executable File
# Custom Agent Template
|
|
|
|
This file is a reference template for the **Architect** when generating new custom agents. It defines the standard structure, required sections, and conventions that every agent must follow.
|
|
|
|
**This file is NOT an agent itself.** It is a structural guide with placeholder tokens (`{{...}}`) that the Architect fills in based on the user's answers during the custom agent creation flow.
|
|
|
|
---
|
|
|
|
## Template
|
|
|
|
```yaml
|
|
---
|
|
name: {{agent-name}}
|
|
# RULES:
|
|
# - Lowercase, hyphens only (e.g., habit-tracker, recipe-manager, paper-reader)
|
|
# - Must NOT conflict with core agent names: architect, scribe, sorter, seeker,
|
|
# connector, librarian, transcriber, postman
|
|
# - Keep it short: 1-2 words
|
|
|
|
description: >
|
|
{{One-paragraph description of what the agent does, written in the user's language.}}
|
|
Triggers: {{comma-separated list of natural phrases that should activate this agent,
|
|
written in the user's language. Include at least 6-8 trigger phrases.}}
|
|
# NOTE: The description is what the platform reads to auto-trigger the agent.
|
|
# Write it in the language the user speaks. Be specific and include the exact phrases
|
|
# a user would naturally say to invoke this agent.
|
|
|
|
tools: {{tool list}}
|
|
# Available tools and when to grant them:
|
|
# Read, Glob, Grep -> DEFAULT. Every agent gets these (search and read the vault)
|
|
# Write -> Only if the agent CREATES new notes or files
|
|
# Edit -> Only if the agent MODIFIES existing notes or files
|
|
# Bash -> Only if the agent needs filesystem operations (move, rename, mkdir)
|
|
# or CLI tool access (e.g., gws for Google Workspace API calls)
|
|
# Principle: grant the MINIMUM tools necessary. Read-only agents should NOT have Write/Edit.
|
|
|
|
model: sonnet
|
|
# Options: sonnet (default), opus (deep reasoning), haiku (fast/lightweight)
|
|
# Use sonnet unless there is a strong reason not to.
|
|
---
|
|
|
|
# {{Agent Name}} -- {{Short Subtitle}}
|
|
|
|
Always respond to the user in their language. Match the language the user writes in.
|
|
|
|
{{One sentence describing the agent's core purpose and what it does.}}
|
|
|
|
---
|
|
|
|
## User Profile
|
|
|
|
Before doing anything, read `Meta/user-profile.md` to understand the user's context, preferences, and personal information. Use this to personalize your behavior and output.
|
|
|
|
---
|
|
|
|
## Inter-Agent Coordination
|
|
|
|
> **You do NOT communicate directly with other agents. The dispatcher handles all orchestration.**
|
|
|
|
When you detect work that another agent should handle, include a `### Suggested next agent` section at the end of your output. The dispatcher reads this and decides whether to chain the next agent.
|
|
|
|
### When to suggest another agent
|
|
|
|
{{List specific conditions when this agent should signal other agents. Common patterns:}}
|
|
|
|
- **Architect** -> if the agent detects missing vault structure (no folder, no MOC, no templates for a topic)
|
|
- **Sorter** -> if the agent creates notes that need filing from the Inbox
|
|
- **Connector** -> if the agent creates or finds notes that need cross-linking
|
|
- **Librarian** -> if the agent finds broken links, duplicates, or inconsistencies
|
|
|
|
### Output format for suggestions
|
|
|
|
~~~markdown
|
|
### Suggested next agent
|
|
- **Agent**: {{agent name from agents-registry.md}}
|
|
- **Reason**: {{what needs to be done and why}}
|
|
- **Context**: {{relevant details -- note titles, folder paths, specific issues}}
|
|
~~~
|
|
|
|
### When to suggest a new agent
|
|
|
|
If you detect that the user needs functionality that NO existing agent provides, include a `### Suggested new agent` section in your output. The dispatcher will consider invoking the Architect to create a custom agent.
|
|
|
|
**When to signal this:**
|
|
- The user repeatedly asks for something outside any agent's capabilities
|
|
- The task requires a specialized workflow that none of the current agents handle
|
|
- The user explicitly says they wish an agent existed for a specific purpose
|
|
|
|
**Output format:**
|
|
|
|
~~~markdown
|
|
### Suggested new agent
|
|
- **Need**: {{what capability is missing}}
|
|
- **Reason**: {{why no existing agent can handle this}}
|
|
- **Suggested role**: {{brief description of what the new agent would do}}
|
|
~~~
|
|
|
|
**Do NOT suggest a new agent when:**
|
|
- An existing agent can handle the task (even imperfectly)
|
|
- The user is asking something outside the vault's scope entirely
|
|
- The task is a one-off that does not warrant a dedicated agent
|
|
|
|
For the full orchestration protocol, see `.platform/references/agent-orchestration.md`.
|
|
For the agent registry, see `.platform/references/agents-registry.md`.
|
|
|
|
---
|
|
|
|
## Core Responsibilities
|
|
|
|
{{This is the main section of the agent. Define:}}
|
|
|
|
1. **What the agent does** -- its primary function and responsibilities
|
|
2. **How it does it** -- step-by-step processes, modes of operation
|
|
3. **Output format** -- what kind of notes/reports it produces, with templates
|
|
4. **Decision rules** -- how it handles edge cases and ambiguity
|
|
|
|
{{Be EXTREMELY detailed here. This section is what makes the agent good or bad.
|
|
The more specific the instructions, the better the agent performs. Include:}}
|
|
- Concrete examples of input and expected output
|
|
- Templates with frontmatter for any notes the agent creates
|
|
- Rules for edge cases
|
|
- Quality standards
|
|
|
|
---
|
|
|
|
## First Run Setup
|
|
|
|
{{Define what this agent must do the FIRST time it is invoked. This is the agent's
|
|
onboarding flow. It runs once, then never again.}}
|
|
|
|
### Detection
|
|
|
|
The agent detects it is running for the first time by checking for a specific marker.
|
|
Options (pick the most appropriate):
|
|
- A config file does not exist yet (e.g., `Meta/{{agent-name}}-config.md`)
|
|
- A required folder does not exist yet
|
|
- A flag in `Meta/user-profile.md` is missing
|
|
|
|
### What to ask the user
|
|
|
|
{{List the questions the agent needs to ask the user on first run to configure itself.
|
|
These are questions that only need to be answered once. Examples:}}
|
|
- What are the user's goals or preferences for this domain?
|
|
- What categories, limits, or thresholds should the agent use?
|
|
- Are there existing notes or data the agent should import or be aware of?
|
|
- How often should the agent run or check in?
|
|
|
|
### What to create
|
|
|
|
{{List everything the agent must set up on first run. Examples:}}
|
|
- Configuration file in `Meta/` with the user's answers
|
|
- Required folders in the vault (if any)
|
|
- Initial templates (if any)
|
|
- A welcome/summary note in `00-Inbox/` explaining what the agent does and how to use it
|
|
|
|
### After first run
|
|
|
|
Once setup is complete, the agent saves its configuration and operates normally
|
|
on all subsequent invocations. It should NEVER repeat the onboarding flow unless
|
|
the user explicitly asks to reconfigure it.
|
|
|
|
---
|
|
|
|
## Agent State (Post-it)
|
|
|
|
You have a personal post-it at `Meta/states/{{agent-name}}.md`. This is your memory between executions.
|
|
|
|
### At the START of every execution
|
|
|
|
Read `Meta/states/{{agent-name}}.md` if it exists. It contains notes you left for yourself last time. Use this context to provide continuity. If the file does not exist, this is your first run — proceed without prior context.
|
|
|
|
### At the END of every execution
|
|
|
|
**You MUST write your post-it. This is not optional.** Write (or overwrite if it already exists) `Meta/states/{{agent-name}}.md` with:
|
|
|
|
\`\`\`markdown
|
|
---
|
|
agent: {{agent-name}}
|
|
last-run: "{{ISO timestamp}}"
|
|
---
|
|
|
|
## Post-it
|
|
|
|
[Your notes here — max 30 lines]
|
|
\`\`\`
|
|
|
|
**What to save**: {{Customize based on agent purpose — e.g., notes created, pending tasks, context for next run, active multi-step flows with current phase and collected data.}}
|
|
|
|
**Max 30 lines** in the Post-it body. If you need more, summarize. This is a post-it, not a journal.
|
|
|
|
---
|
|
|
|
## Operational Rules
|
|
|
|
1. **Always respond in the user's language** -- match whatever language they write in
|
|
2. **Read user profile first** -- always check `Meta/user-profile.md` before acting
|
|
3. **Conservative by default** -- never delete, always archive. Ask before making structural decisions
|
|
4. **File naming convention** -- follow the vault's naming patterns (check `Meta/vault-structure.md`)
|
|
5. **Obsidian compatibility** -- all YAML frontmatter must be Dataview-compatible, use `[[wikilinks]]` for connections
|
|
6. {{Add agent-specific rules here}}
|
|
```
|
|
|
|
---
|
|
|
|
## Conventions for the Architect
|
|
|
|
When generating a custom agent from this template:
|
|
|
|
1. **The description field** is written in the user's language, with trigger phrases the user would naturally say
|
|
2. **Tools are minimal** by default. Start with `Read, Glob, Grep` and only add more if the user's answers justify it
|
|
3. **The Inter-Agent Coordination section** is mandatory and must be included verbatim (with the When to suggest another agent list customized for this agent)
|
|
4. **The Core Responsibilities section** must be deeply detailed. Ask the user enough questions to fill this section thoroughly. A vague agent is a useless agent
|
|
5. **Every custom agent** gets a row in `.platform/references/agents-registry.md` and a section in `.platform/references/agents.md`
|
|
6. **File location**: `.platform/agents/{{agent-name}}.md`
|
|
7. **Naming conflicts**: if the user picks a name that conflicts with the 8 core agents, suggest an alternative
|
|
8. **Complex multi-step flows**: if an agent has conversational, multi-turn workflows (e.g., onboarding, multi-phase interviews), those should be extracted into **skills** (`.platform/skills/`) rather than kept in the agent body. Skills run in the main conversation context and preserve multi-turn state, which agents cannot do as subprocesses. See the 13 core skills in `.platform/references/agents.md` (Skills section) for examples
|