Official Position: This repository is public analysis of Claude Code's documented architecture patterns, NOT based on leaked source code. All observations are from public repositories, official documentation, and reverse-engineering through official interfaces.
This is a research notebook on how Claude Code orchestrates multi-agent workflows, plugin systems, and skill composition. It documents the patterns Boss Mode leverages to integrate as a native Claude Code plugin.
- Claude Code Architecture Overview
- Plugin System Design
- Command & Agent Orchestration
- Skills System
- Multi-Agent Workflow Patterns
- Boss Mode Integration Points
Claude Code is a CLI-based AI coding assistant built on:
- Runtime: Bun (fast JavaScript/TypeScript execution)
- Language: TypeScript (strict mode)
- Terminal UI: React + Ink (interactive CLI components)
βββββββββββββββββββββββββββββββββββ
β Claude API (LLM Interface) β
ββββββββββββββββ¬βββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββ
β Query Engine / Orchestrator β β Coordinates tools, agents, context
ββββββββββββββββ¬βββββββββββββββββββ
β
ββββββββββΌβββββββββ
β β β
βββββββΌββ ββββΌβββ ββββΌβββ
β Tools β βAgentsβ βTasksβ β Extensible subsystems
βββββββββ ββββββββ βββββββ
β β β
ββββββββββΌβββββββββ
β
βββββββββββββ΄βββββββββββ
β Plugin / Skill Loader β β Extension discovery
ββββββββββββββββββββββββ
src/
βββ commands/ # 103+ slash commands
βββ tools/ # 45+ tools (Bash, File, Git, Web, etc.)
βββ skills/ # Bundled skill definitions
βββ plugins/ # Plugin registry & loader
βββ agents/ # Agent definitions
βββ coordinator/ # Multi-agent orchestration
βββ services/ # API, MCP, OAuth, LSP
βββ types/ # Type definitions (command, plugin, skill, etc.)
A Claude Code plugin declares itself via plugin.json or manifest.json:
{
"name": "boss-mode",
"version": "1.0.0",
"description": "Boss layer for Claude Code",
"author": { "name": "Author", "email": "author@example.com" },
"repository": { "type": "git", "url": "git@github.com:user/repo.git" },
"commandsPath": "commands",
"agentsPath": "agents",
"skillsPath": "skills",
"hooksConfig": { /* post-sampling hooks */ },
"mcpServers": { /* MCP server definitions */ },
"lspServers": { /* LSP server definitions */ }
}A plugin can provide:
| Component | Location | Format | Purpose |
|---|---|---|---|
| Commands | commands/ |
.md or .ts files |
Slash commands (e.g., /boss, /boss-pr) |
| Agents | agents/ |
.md or .ts files |
Multi-step agents that coordinate tools |
| Skills | skills/ |
.md with frontmatter |
Reusable workflows and patterns |
| Hooks | (inline) | Config object | Post-sampling logic to modify outputs |
| Output Styles | output-styles/ |
.ts files |
Custom terminal formatting |
- Discovery: Claude Code scans
.claude/plugins/(project-local) and~/.claude/plugins/(global) - Manifest Parsing: Each plugin must have
plugin.jsonwith valid schema - Component Registration: Commands, agents, skills are lazy-loaded on first invocation
- Isolation: Plugins are isolated; cannot directly import each other's internals
Each command in commands/ follows this pattern:
---
name: boss
description: Evaluate an idea before coding
version: 1.0.0
user-invocable: true
allowed-tools: Read, Write, Bash
---
# Prompt Content
[Full prompt text explaining behavior]Key Fields:
name: Identifier for invocation (/boss)user-invocable: Whether users can call directlyallowed-tools: Which tools this command can useversion: For tracking plugin evolution
Agents are similar but coordinate multiple steps:
---
name: ceo-boss
description: CEO perspective on decisions
type: agent
---
# Agent Instructions
You are the CEO boss...
[Full behavioral instructions]Key Difference from Commands: Agents can spawn sub-agents, maintain state across turns, and coordinate multiple tools.
User Input: "/boss-pr"
β
Command Registry Lookup: Find boss-pr.md in commands/
β
Parse Frontmatter: Extract metadata
β
Load Prompt Content: Read full command definition
β
Invoke Claude API: Send prompt + context + tools
β
Tool Invocation Loop: Execute approved tools (Bash, Read, etc.)
β
Format & Display: Render output in terminal
A Skill is a reusable prompt pattern that can be:
- Invoked as a slash command
- Composed with other skills
- Stored and versioned
- Parameterized with arguments
---
name: boss-mode
description: Decision framework for hard product choices
user-invocable: true
version: 1.0.0
---
# Skill Content
[Reusable prompt logic]-
Bundled Skills: Compiled into Claude Code binary
- Example:
/remember,/loop,/skillify - Location:
src/skills/bundled/
- Example:
-
Plugin Skills: Loaded from disk
- Location:
plugin-name/skills/ - Lazy-loaded on first invocation
- Location:
-
Inline Skills: Defined in SKILL.md directly
- Multi-part workflow (colleague-skill, boss-mode)
Skills can nest and reference each other:
/boss
β (uses)
boss-pr β evaluates a specific PR change
β (generates)
/boss-roast β summary feedback
Claude Code has a sophisticated multi-agent system:
βββββββββββββββββββββββββββββββ
β Main Agent (User Input) β
ββββββββββββββββ¬βββββββββββββββ
β
ββββββββΌβββββββ
β Coordinator β β Routes to subagents, merges results
ββββββββ¬βββββββ
β
βββββββββββΌββββββββββ
β β β
ββββββΌβββ βββββΌββββ βββββΌβββββ
βAgent 1β βAgent 2β βAgent 3 β β Parallel or sequential
βββββββββ βββββββββ ββββββββββ
Boss Mode uses three agents that provide different perspectives:
User Input: "/boss ceo"
β
Main Agent: Route to /ceo-boss
β
CEO Agent: Evaluate ROI/speed perspective
β
Return: CEO verdict with cuts
For blended (no boss specified):
User Input: "/boss"
β
Coordinator: Spawn three subagents (CEO, EM, PM)
β
βββββββββββββββββββββββββββββββββ
β β β
CEO EM PM
ββββββββββββββββββββββ
β (merge results)
β
Output: Three one-line takes + consensus verdict
Agents communicate via:
- Context Passing: Previous agent output becomes next agent input
- Task System: Agents can create/update/list tasks
- Message Tool: Agents send direct messages to other agents
- Shared Memory: Via Claude Code's memory system (auto-memory)
Boss Mode provides four slash commands:
/boss β Evaluate idea
/boss-pr β Review PR
/boss-plan β Cut scope
/boss-roast β Honest feedback
/boss-vs-engineer β Dual-agent debate
Each is a .md file with frontmatter + prompt content.
Boss Mode provides three subagents:
/ceo-boss β CEO perspective
/eng-manager-boss β EM perspective
/pm-boss β PM perspective
These are invoked either:
- Directly: User calls
/ceo-boss [issue] - Indirectly: Main agent spawns them as subagents via coordinator
Boss Mode bundles reusable patterns in skills/boss-mode/:
/boss-mode β Main skill registry entry
Allows composition like:
/boss "idea"
β uses boss-mode skill internally
β may invoke /boss-roast for summary
Boss Mode declares itself via .claude-plugin/plugin.json:
{
"commandsPath": "commands",
"agentsPath": "agents",
"skillsPath": "skills"
}This tells Claude Code where to find extensible components.
Boss Mode uses these tools:
| Tool | Use | Command |
|---|---|---|
| Bash | Run git commands | /boss-pr reads git diff |
| Read | Read PR diffs, issues, specs | /boss-pr, /boss-plan |
| Grep | Search codebase | /boss-pr can search for related code |
| Agent | Spawn subagents | /boss spawns CEO/EM/PM agents |
Boss Mode integrates with Claude Code's context system:
- Project Context: Reads
package.json,.git/, CI config - Codebase Context: Uses git diff, file reads to understand scope
- Session Memory: Remembers previous boss verdicts to avoid contradiction
- User Preferences: Respects Claude Code settings (model, timeout, etc.)
Claude Code does NOT load all commands upfront. Instead:
// commands/boss/index.ts (light metadata)
export const boss = {
name: "boss",
description: "...",
load: () => import("./boss.ts") // lazy
}
// commands/boss/boss.ts (heavy implementation)
export const bossFn = (args) => { /* implementation */ }Why: 50+ commands means 5 seconds startup if all loaded. Lazy loading reduces startup to <500ms.
Boss Mode Application: Commands are .md files (prompts), so lazy loading happens automatically when Claude Code invokes them.
Each command declares allowed-tools:
allowed-tools: Read, Write, Bash, BashClaude Code blocks tool invocation outside this list. This prevents:
- Plugin A from secretly calling
BashToolto steal data - Malicious plugins from making network calls
Boss Mode Application: Only declares needed tools (Read, Bash for git diff)
Claude Code supports hooks in plugin manifest:
{
"hooksConfig": {
"post-sampling": {
"handler": "hooks/post-sampling.ts",
"priority": 10
}
}
}The hook can modify Claude's output before display. Example: filter sensitive data, reformat, auto-save.
Boss Mode Use Case: Could add a hook that auto-saves boss verdicts to a decision log.
Claude Code has an AgentTool that lets one agent spawn another:
await agent.spawn({
type: "subagent",
model: "claude-opus",
prompt: "...",
tools: ["BashTool", "ReadTool"]
})Results are merged back to the parent agent.
Boss Mode Application: /boss spawns three subagents (CEO, EM, PM) in parallel, then merges verdicts.
Output formatting is pluggable:
output-styles/
βββ markdown.ts
βββ json.ts
βββ ascii-table.ts
User can configure: output_style = "ascii-table"
Boss Mode Use Case: Could provide boss-style output formatter with specific visual breaks.
When Claude Code source was exposed (via npm source maps), the community reverse-engineered:
- Multi-agent orchestration (how subagents coordinate)
- Quota system (cost tracking across agents)
- Task/memory persistence (auto-memory across sessions)
- Plugin discovery (how third-party extensions are found)
The community is actively discussing how Claude Code makes decisions. Boss Mode is the answer to:
"Claude Code can write code. But how does it know what to write? How does it avoid over-engineering?"
Boss Mode is positioned as: "The decision layer Claude Code was missing."
Boss Mode does NOT:
- β Use leaked source code
- β Clone internal prompt systems
- β Reproduce proprietary algorithms
Boss Mode DOES:
- β Use official plugin interfaces
- β Implement a published research pattern (three-perspective decision-making)
- β Solve a real problem (overengineering in code generation)
Could we do this with one prompt? Yes, but:
- Clarity: Three clear voices are easier to understand than one muddled voice
- Modularity: Users can invoke
/ceo-bossalone for speed-focused feedback - Future Extensibility: Easy to add
/founder-boss,/investor-boss, etc. - Debate Value:
/boss-vs-engineeris interesting because there are real agents with opposing views
Could we use .ts files (like OpenClaw)? Yes, but:
- Accessibility: Markdown is easier to edit and fork than TypeScript
- Version Control: Cleaner diffs on prompt changes
- Portability: Same
.mdfile works on Claude Code, OpenClaw, colleague-skill - Immutability: Prompts are data, not code
- Legal Risk: Anthropic could issue DMCA takedown
- Reputational Risk: "Forking leaked code" vs. "Building original plugin"
- Sustainability: Leaks get old. Official APIs stay relevant.
- Custom Boss Creation:
/create-boss(like/create-colleague) - Decision Audit Trail: Auto-save all boss verdicts to a decision log
- Team Bosses: Sync boss verdicts across team members
- Roast Engine: Advanced roasting with specific code pattern detection
- Multi-Modal Boss: Visual mockups, performance graphs, etc.
- GitHub Integration: Auto-comment boss verdicts on PRs
- Slack Integration: Post boss verdicts to #engineering-decisions
- MCP Servers: Boss Mode as an MCP server for other tools
- IDE Integration: VS Code / JetBrains plugin that calls boss-mode
- Claude Code Official Repository
- colleague-skill System
- OpenClaw Plugin Architecture
- Published Research: Decision-Making Frameworks
This document is a research notebook on Claude Code's architecture patterns, not a leaker's confession.
The goal: Help builders understand how to extend Claude Code responsibly and effectively.


