@ccx-agent/opencode-ccx 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # ccx — Coding Copilot, eXtended
2
+
3
+ An [OpenCode](https://opencode.ai) plugin that turns your AI coding agent into a disciplined software engineer. ccx injects a complete behavioral framework — system prompt sections, specialized subagents, and safety hooks — so the agent writes less unnecessary code, verifies its own work, and thinks before running destructive commands.
4
+
5
+ ## Why
6
+
7
+ Out of the box, LLM coding agents tend to over-engineer, skip verification, and act before thinking. ccx fixes this by injecting a set of behavioral constraints and specialized subagents into your OpenCode session:
8
+
9
+ - **Writes less, not more** — no speculative abstractions, no unrequested refactors, no gold-plating
10
+ - **Verifies before reporting done** — an adversarial verification agent stress-tests implementations with real commands, not code reading
11
+ - **Asks before destroying** — a risk guard flags `rm -rf`, `git push --force`, and other irreversible actions before they execute
12
+ - **Delegates intelligently** — a coordinator agent decomposes complex tasks into research, implementation, and verification phases across parallel workers
13
+
14
+ ## What You Get
15
+
16
+ | Component | What it does |
17
+ |-----------|-------------|
18
+ | **ccx** (primary agent) | Main agent with 7 composable system prompt sections governing coding discipline, risk awareness, tool usage, and output style |
19
+ | **ccx-explore** | Read-only codebase search specialist. Fast parallel file/content search across large repos |
20
+ | **ccx-plan** | Read-only software architect. Investigates code and produces step-by-step implementation plans with critical file lists |
21
+ | **ccx-verification** | Adversarial verifier with VERDICT protocol (PASS/FAIL/PARTIAL). Runs builds, tests, linters, then tries to break things with boundary values, concurrency probes, and idempotency checks |
22
+ | **ccx-general-purpose** | Multi-strategy task worker for anything that doesn't fit the specialists |
23
+ | **ccx-coordinator** | Multi-agent orchestrator. Decomposes work into Research → Synthesis → Implementation → Verification phases across parallel workers |
24
+ | **Risk Guard** | `tool.execute.before` hook that warns on destructive operations |
25
+ | **Verification Reminder** | `tool.execute.after` hook that nudges verification after N file edits |
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ bun add ccx
31
+ ```
32
+
33
+ Add to your OpenCode config:
34
+
35
+ ```jsonc
36
+ // ~/.config/opencode/opencode.json
37
+ {
38
+ "plugin": [
39
+ "ccx"
40
+ // ... your other plugins
41
+ ]
42
+ }
43
+ ```
44
+
45
+ Or use a local build:
46
+
47
+ ```jsonc
48
+ {
49
+ "plugin": [
50
+ "file:///path/to/ccx/dist/index.js"
51
+ ]
52
+ }
53
+ ```
54
+
55
+ Restart OpenCode. Press `@` to see `ccx` in the agent list.
56
+
57
+ ## Configure
58
+
59
+ Create `~/.config/opencode/ccx.json` (global) or `.opencode/ccx.json` (project-level):
60
+
61
+ ```json
62
+ {
63
+ "enabled": true,
64
+ "disabled_sections": [],
65
+ "disabled_hooks": [],
66
+ "output_style": null,
67
+ "verification": {
68
+ "auto_remind": true,
69
+ "min_file_edits": 3
70
+ }
71
+ }
72
+ ```
73
+
74
+ | Field | Type | Default | Description |
75
+ |-------|------|---------|-------------|
76
+ | `enabled` | boolean | `true` | Master toggle |
77
+ | `disabled_sections` | string[] | `[]` | System prompt sections to skip (e.g., `["tone-style", "output-efficiency"]`) |
78
+ | `disabled_hooks` | string[] | `[]` | Hooks to disable (e.g., `["risk-guard"]`) |
79
+ | `output_style` | string \| null | `null` | Custom output style name |
80
+ | `verification.auto_remind` | boolean | `true` | Nudge verification after file edits |
81
+ | `verification.min_file_edits` | number | `3` | Edit threshold before nudge |
82
+
83
+ ## How It Works
84
+
85
+ ccx hooks into OpenCode's plugin lifecycle at two points:
86
+
87
+ **1. `config` hook** — Injects the `ccx` primary agent (with full system prompt) and 5 subagents into `config.agent`. The primary agent's prompt is composed from 7 independent sections + subagent orchestration guidance.
88
+
89
+ **2. `tool.execute.before/after` hooks** — Risk Guard scans commands for destructive patterns pre-execution; Verification Reminder tracks file edit count post-execution.
90
+
91
+ ### System Prompt Sections
92
+
93
+ The primary agent's system prompt is assembled from these composable sections:
94
+
95
+ | Section | Purpose |
96
+ |---------|---------|
97
+ | `intro` | Agent identity and trust boundary |
98
+ | `system-rules` | Permission model, context compression, prompt injection awareness |
99
+ | `doing-tasks` | Coding discipline — scope control, minimal abstraction, honest reporting |
100
+ | `actions` | Risk classification for reversible vs irreversible operations |
101
+ | `using-tools` | Prefer dedicated tools over Bash, parallel tool call strategy |
102
+ | `tone-style` | No emojis, concise output, code reference formatting |
103
+ | `output-efficiency` | Lead with answers, skip filler, milestone-based updates |
104
+
105
+ ### Verification Agent
106
+
107
+ The verification agent is the most opinionated component. Key behaviors:
108
+
109
+ - **Runs commands, not reads code** — every check must include a `Command run` block with actual terminal output
110
+ - **Catches its own rationalizations** — the prompt explicitly lists excuses the agent will reach for ("the code looks correct", "the tests already pass") and instructs it to do the opposite
111
+ - **Adapts by change type** — different verification strategies for frontend, backend, CLI, infrastructure, database migrations, refactoring, etc.
112
+ - **Requires adversarial probes** — at least one concurrency, boundary value, or idempotency test before issuing PASS
113
+
114
+ ## Project Structure
115
+
116
+ ```
117
+ ccx/
118
+ ├── src/
119
+ │ ├── index.ts # Plugin entry point
120
+ │ ├── prompts/ # 7 system prompt sections + compose + environment
121
+ │ ├── agents/ # 5 subagent definitions (explore, plan, verification, coordinator, general-purpose)
122
+ │ ├── hooks/ # config-handler, risk-guard, verification-reminder, environment-context, system-prompt-injector
123
+ │ ├── config/ # Zod schema + JSONC config loader
124
+ │ └── plugin/ # OpenCode plugin interface + tool registry
125
+ ├── package.json
126
+ └── tsconfig.json
127
+ ```
128
+
129
+ ## License
130
+
131
+ MIT
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from "./types";
2
+ export declare function getCoordinatorAgentPrompt(): string;
3
+ export declare const COORDINATOR_AGENT_DEFINITION: AgentDefinition;
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from "./types";
2
+ export declare function getExploreAgentPrompt(): string;
3
+ export declare const EXPLORE_AGENT_DEFINITION: AgentDefinition;
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from "./types";
2
+ export declare function getGeneralPurposeAgentPrompt(): string;
3
+ export declare const GENERAL_PURPOSE_AGENT_DEFINITION: AgentDefinition;
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from "./types";
2
+ export declare function getPlanAgentPrompt(): string;
3
+ export declare const PLAN_AGENT_DEFINITION: AgentDefinition;
@@ -0,0 +1,7 @@
1
+ export type AgentDefinition = {
2
+ name: string;
3
+ description: string;
4
+ getSystemPrompt: () => string;
5
+ disallowedTools?: string[];
6
+ readOnly?: boolean;
7
+ };
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from "./types";
2
+ export declare function getVerificationAgentPrompt(): string;
3
+ export declare const VERIFICATION_AGENT_DEFINITION: AgentDefinition;
@@ -0,0 +1,2 @@
1
+ import type { OhMyCCAgentConfig } from "./schema";
2
+ export declare function loadConfig(directory: string): OhMyCCAgentConfig;
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ export declare const configSchema: z.ZodObject<{
3
+ enabled: z.ZodDefault<z.ZodBoolean>;
4
+ disabled_sections: z.ZodDefault<z.ZodArray<z.ZodString>>;
5
+ disabled_hooks: z.ZodDefault<z.ZodArray<z.ZodString>>;
6
+ output_style: z.ZodDefault<z.ZodNullable<z.ZodString>>;
7
+ verification: z.ZodDefault<z.ZodObject<{
8
+ auto_remind: z.ZodDefault<z.ZodBoolean>;
9
+ min_file_edits: z.ZodDefault<z.ZodInt>;
10
+ }, z.core.$strip>>;
11
+ }, z.core.$strip>;
12
+ export type OhMyCCAgentConfig = z.infer<typeof configSchema>;
@@ -0,0 +1,2 @@
1
+ import type { OhMyCCAgentConfig } from "../config/schema";
2
+ export declare function createConfigHook(config: OhMyCCAgentConfig, directory: string): (input: Record<string, unknown>) => Promise<void>;
@@ -0,0 +1,9 @@
1
+ type EnvironmentContextValue = {
2
+ cwd: string;
3
+ isGit: boolean;
4
+ platform: string;
5
+ shell: string;
6
+ };
7
+ export declare function getEnvironmentContext(sessionID: string): EnvironmentContextValue | undefined;
8
+ export declare function createEnvironmentContext(directory: string): (input: unknown, output: unknown) => Promise<void>;
9
+ export {};
@@ -0,0 +1 @@
1
+ export declare function createRiskGuard(): (input: unknown, output: unknown) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { OhMyCCAgentConfig } from "../config/schema";
2
+ export declare function createSystemPromptInjector(config: OhMyCCAgentConfig): (input: unknown, output: unknown) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { OhMyCCAgentConfig } from "../config/schema";
2
+ export declare function createVerificationReminder(config: OhMyCCAgentConfig): (input: unknown, output: unknown) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ declare const CCX: Plugin;
3
+ export default CCX;
4
+ export type { OhMyCCAgentConfig } from "./config/schema";