rrce-workflow 0.2.91 → 0.2.92

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 CHANGED
@@ -5,13 +5,14 @@
5
5
  [![npm version](https://badge.fury.io/js/rrce-workflow.svg)](https://www.npmjs.com/package/rrce-workflow)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- RRCE-Workflow is a tool that turns your AI coding assistant (GitHub Copilot, Claude Desktop, Antigravity IDE, etc.) into a **context-aware agent**.
8
+ RRCE-Workflow transforms your AI coding assistant (GitHub Copilot, OpenCode, Claude Desktop, Antigravity IDE) into a **context-aware agent** with persistent project knowledge.
9
9
 
10
- It standardizes how AI agents understand your project through:
11
- 1. **Global Knowledge Base**: Centralized context management across all your projects.
12
- 2. **MCP Hub**: A Model Context Protocol server that exposes your code and knowledge to any MCP-compatible client.
13
- 3. **Semantic Search (RAG)**: Local, privacy-first vector indexing for deep codebase understanding.
14
- 4. **Structured Agent Pipelines**: Reusable prompts for Research, Planning, Execution, and Documentation.
10
+ **Key Features:**
11
+ - **Global Knowledge Base**: Centralized context management across all your projects (`~/.rrce-workflow/`).
12
+ - **MCP Hub**: A Model Context Protocol server exposing tools, resources, and prompts to any MCP-compatible client.
13
+ - **Semantic Search (RAG)**: Local, privacy-first vector indexing powered by `@xenova/transformers` for deep codebase understanding.
14
+ - **Structured Agent Pipelines**: 7 specialized agents (Init, Research, Planning, Executor, Docs, Sync, Doctor) for end-to-end development workflows.
15
+ - **Task Management**: Built-in CRUD operations for tracking high-level tasks via MCP tools.
15
16
 
16
17
  ---
17
18
 
@@ -58,7 +59,24 @@ RRCE-Workflow uses the [Model Context Protocol](https://modelcontextprotocol.io/
58
59
  ### Features
59
60
  * **Universal Context**: Access your project's `project-context.md`, architecture docs, and task history from *any* MCP-enabled tool.
60
61
  * **Cross-Project References**: Your AI can read documentation from Project A while working on Project B (perfect for monorepos or microservices).
61
- * **Tools & Resources**: Exposes tools like `search_knowledge` and `get_project_context` directly to the model.
62
+ * **12 MCP Tools**: Including `search_knowledge`, `get_project_context`, `resolve_path`, task CRUD operations, and more.
63
+
64
+ ### MCP Tools Reference
65
+
66
+ | Tool | Description |
67
+ |------|-------------|
68
+ | `resolve_path` | Resolve RRCE configuration paths (RRCE_DATA, WORKSPACE_ROOT, etc.) for a project |
69
+ | `list_projects` | List all projects exposed via MCP |
70
+ | `get_project_context` | Get the project-context.md for a specific project |
71
+ | `search_knowledge` | Semantic search (RAG) across project knowledge bases |
72
+ | `index_knowledge` | Update the semantic search index for a project |
73
+ | `list_agents` | List available RRCE agents and their arguments |
74
+ | `get_agent_prompt` | Get the system prompt for a specific agent with context injection |
75
+ | `list_tasks` | List all tasks for a project |
76
+ | `get_task` | Get details of a specific task |
77
+ | `create_task` | Create a new task in the project |
78
+ | `update_task` | Update an existing task's meta.json |
79
+ | `delete_task` | Delete a task from the project |
62
80
 
63
81
  ### Connecting Your IDE
64
82
 
@@ -149,36 +167,40 @@ Stores everything in a `.rrce-workflow` folder inside your project root.
149
167
 
150
168
  ---
151
169
 
152
- ## 🤖 The Agent Pipeline
170
+ ## The Agent Pipeline
153
171
 
154
- Once installed, you gain access to powerful agent workflows. Invoke them using your AI assistant's chat interface (if supported) or by pasting the prompts.
172
+ Once installed, you gain access to 7 specialized agent workflows. Invoke them via your AI assistant's chat interface or through MCP tools.
155
173
 
156
- | Agent | Purpose | Recommended Use |
157
- |-------|---------|-----------------|
158
- | **Init** | **Context Establishment** | Run once at project start to analyze tech stack & architecture. |
159
- | **Research** | **Scope Definition** | Use when starting a complex feature to clarify requirements & risks. |
160
- | **Planning** | **Execution Strategy** | Generates a step-by-step implementation plan (checklist). |
161
- | **Execute** | **Implementation** | The "coding" phase. Implements the plan created by the Planning agent. |
162
- | **Docs** | **Documentation** | Generates tailored docs (API refs, guides) from code. |
163
- | **Sync** | **Knowledge Maintenance** | Scans code changes to update the `knowledge/` folder. |
164
- | **Doctor** | **Health Analysis** | Analyzes codebase for issues, tech debt, and improvement opportunities. |
174
+ | Agent | ID | Purpose | Key Arguments |
175
+ |-------|----|---------|---------------|
176
+ | **Init** | `init` | Analyze codebase, establish project context and semantic index | `PROJECT_NAME` (optional) |
177
+ | **Research** | `research_discussion` | Interactive requirements clarification through dialogue | `TASK_SLUG`, `REQUEST` |
178
+ | **Planning** | `planning_discussion` | Transform research into actionable execution plan | `TASK_SLUG` |
179
+ | **Executor** | `executor` | Implement the plan - the ONLY agent authorized to modify code | `TASK_SLUG`, `BRANCH` |
180
+ | **Docs** | `documentation` | Generate project documentation (API, architecture, changelog) | `DOC_TYPE`, `TASK_SLUG` |
181
+ | **Sync** | `sync` | Reconcile knowledge base with current codebase state | `SCOPE` (optional) |
182
+ | **Doctor** | `doctor` | Analyze codebase health, identify issues, recommend improvements | `PROJECT_NAME`, `FOCUS_AREA` |
165
183
 
166
184
  ### Recommended Workflow
167
- 1. **`/init`**: "Analyze this codebase." -> Creates `project-context.md`.
168
- 2. **`/research`**: "I need to add user auth." -> Generates a Research Brief.
169
- 3. **`/plan`**: "Create a plan for user auth." -> Generates an Implementation Plan.
170
- 4. **`/execute`**: "Implement the auth plan." -> Writes code across files.
171
- 5. **`/sync`**: "Update knowledge." -> Refreshes context for the next task.
185
+ 1. **`init`**: "Analyze this codebase." Creates `project-context.md` and semantic index.
186
+ 2. **`research_discussion`**: "I need to add user auth." Interactive requirements gathering.
187
+ 3. **`planning_discussion`**: "Create a plan for user auth." Generates implementation checklist.
188
+ 4. **`executor`**: "Implement the auth plan." Writes code, runs tests.
189
+ 5. **`documentation`**: "Generate API docs." Produces release-ready documentation.
190
+ 6. **`sync`**: "Update knowledge." → Refreshes context for the next task.
172
191
 
173
192
  ---
174
193
 
175
- ## 🔍 Semantic Search (RAG)
194
+ ## Semantic Search (RAG)
176
195
 
177
- RRCE-Workflow includes a local, embedding-based search engine.
178
- - **Privacy First**: All embeddings are calculated locally on your CPU/GPU. No code leaves your machine.
179
- - **Smart Context**: Allows the agent to find relevant code snippets via natural language queries (e.g., "Find the authentication middleware logic") even if keywords don't match exactly.
196
+ RRCE-Workflow includes a local, embedding-based search engine powered by `@xenova/transformers`.
180
197
 
181
- RAG is enabled by default in Express Setup. You can toggle it per-project in the MCP Dashboard.
198
+ - **Privacy First**: All embeddings are calculated locally. No code leaves your machine.
199
+ - **Full Codebase Indexing**: The `index_knowledge` tool scans your entire source tree (respecting skip lists like `node_modules`, `.git`).
200
+ - **Smart Fallback**: If RAG fails or isn't enabled, `search_knowledge` performs line-by-line text matching.
201
+ - **Model**: Uses `Xenova/all-MiniLM-L6-v2` by default (configurable per-project).
202
+
203
+ RAG is enabled by default in Express Setup. You can toggle it per-project in the MCP Dashboard or via `config.yaml`.
182
204
 
183
205
  ---
184
206
 
@@ -187,6 +209,16 @@ RAG is enabled by default in Express Setup. You can toggle it per-project in the
187
209
  - **Node.js 18+**
188
210
  - **Git**
189
211
 
212
+ ## Tech Stack
213
+
214
+ | Component | Technology |
215
+ |-----------|------------|
216
+ | TUI Framework | Ink ^6.6.0 (React-based) |
217
+ | MCP Server | @modelcontextprotocol/sdk ^1.25.1 |
218
+ | Embeddings | @xenova/transformers ^2.17.2 |
219
+ | Build | esbuild |
220
+ | Runtime | Node.js >= 18 |
221
+
190
222
  ## License
191
223
 
192
224
  MIT © RRCE Team
package/dist/index.js CHANGED
@@ -1,11 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
3
  var __esm = (fn, res) => function __init() {
10
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
5
  };
@@ -1725,6 +1719,7 @@ var init_rag = __esm({
1725
1719
  // src/mcp/resources.ts
1726
1720
  import * as fs14 from "fs";
1727
1721
  import * as path16 from "path";
1722
+ import * as os2 from "os";
1728
1723
  import * as crypto from "crypto";
1729
1724
  function resolveProjectPaths(project, pathInput) {
1730
1725
  const config = loadMCPConfig();
@@ -2053,7 +2048,7 @@ function getContextPreamble() {
2053
2048
  const activeProject = detectActiveProject();
2054
2049
  let contextPreamble = "";
2055
2050
  if (activeProject) {
2056
- const rrceHome = process.env.RRCE_HOME || path16.join(__require("os").homedir(), ".rrce-workflow");
2051
+ const rrceHome = process.env.RRCE_HOME || path16.join(os2.homedir(), ".rrce-workflow");
2057
2052
  const workspaceRoot = activeProject.sourcePath || activeProject.path || activeProject.dataPath;
2058
2053
  const rrceData = activeProject.dataPath;
2059
2054
  contextPreamble += `
@@ -2123,7 +2118,7 @@ async function createTask(projectName, taskSlug, taskData) {
2123
2118
  fs14.mkdirSync(path16.join(taskDir, "planning"), { recursive: true });
2124
2119
  fs14.mkdirSync(path16.join(taskDir, "execution"), { recursive: true });
2125
2120
  fs14.mkdirSync(path16.join(taskDir, "docs"), { recursive: true });
2126
- const rrceHome = process.env.RRCE_HOME || path16.join(__require("os").homedir(), ".rrce-workflow");
2121
+ const rrceHome = process.env.RRCE_HOME || path16.join(os2.homedir(), ".rrce-workflow");
2127
2122
  const templatePath = path16.join(rrceHome, "templates", "meta.template.json");
2128
2123
  let meta = {
2129
2124
  task_id: crypto.randomUUID(),
@@ -1,17 +1,19 @@
1
1
  # RRCE-Workflow Architecture
2
2
 
3
3
  > RR Context Engineering Workflow - A selection-agnostic agentic workflow system
4
+ >
5
+ > **Version**: 0.2.91 | **Last Updated**: 2025-12-31
4
6
 
5
7
  ## Overview
6
8
 
7
9
  RRCE-Workflow is a TUI-based agentic code workflow generator designed to work seamlessly across:
8
- - **GitHub Copilot CLI**
10
+ - **OpenCode** (Native agentic TUI environment with custom Primary Agents)
11
+ - **GitHub Copilot** (VSCode with MCP extension)
9
12
  - **Antigravity IDE** (Google's agentic coding environment)
10
- - **OpenCode** (Native agentic TUI environment)
11
- - **VS Code** (with Copilot and other AI extensions)
12
- - **Claude Desktop**
13
+ - **Claude Desktop** (MCP Server integration)
14
+ - **Any MCP-compatible client**
13
15
 
14
- The system provides a structured multi-agent pipeline for software development tasks, with persistent knowledge caching and workspace-aware context management.
16
+ The system provides a structured multi-agent pipeline (7 agents) for software development tasks, with persistent knowledge caching, semantic search (RAG), and workspace-aware context management.
15
17
 
16
18
  ## Core Principles
17
19
 
@@ -24,38 +26,79 @@ The system provides a structured multi-agent pipeline for software development t
24
26
 
25
27
  ## Directory Structure
26
28
 
29
+ ### Source Code Organization
30
+
31
+ ```
32
+ rrce-workflow/
33
+ ├── agent-core/ # Agent prompts and templates (Source of Truth)
34
+ │ ├── prompts/ # 7 agent system prompts (doctor, executor, init, etc.)
35
+ │ ├── templates/ # Output templates for agents
36
+ │ │ └── docs/ # Doc-type specific templates
37
+ │ └── docs/ # Internal documentation (path-resolution.md)
38
+ ├── bin/ # Executable entry points
39
+ │ └── rrce-workflow.js # NPM binary wrapper
40
+ ├── docs/ # High-level architecture docs (this file)
41
+ ├── scripts/ # Maintenance and verification scripts
42
+ ├── src/ # Source code
43
+ │ ├── commands/ # CLI/TUI command implementations
44
+ │ │ └── wizard/ # Interactive setup wizard (setup-flow, link-flow, etc.)
45
+ │ ├── lib/ # Core utilities
46
+ │ │ ├── detection.ts # Project scanning and detection (DetectedProject)
47
+ │ │ ├── detection-service.ts # Singleton project service
48
+ │ │ ├── git.ts # Git utilities
49
+ │ │ ├── paths.ts # Path resolution (RRCE_HOME, RRCE_DATA, etc.)
50
+ │ │ └── preferences.ts # User preference storage
51
+ │ ├── mcp/ # MCP Server implementation
52
+ │ │ ├── handlers/ # Decomposed request handlers
53
+ │ │ │ ├── prompts.ts # Prompt/agent handlers
54
+ │ │ │ ├── resources.ts # Resource handlers
55
+ │ │ │ └── tools.ts # 12 MCP tools (search, index, tasks, etc.)
56
+ │ │ ├── services/ # Backend services
57
+ │ │ │ └── rag.ts # Semantic search with @xenova/transformers
58
+ │ │ ├── ui/ # TUI components (Ink/React)
59
+ │ │ │ └── components/ # Reusable UI components
60
+ │ │ ├── config.ts # MCP configuration management
61
+ │ │ ├── resources.ts # Project data access utilities
62
+ │ │ └── server.ts # MCP Server entry point (Stdio transport)
63
+ │ └── types/ # Global TypeScript definitions
64
+ └── temp_rag_test/ # RAG testing environment
65
+ ```
66
+
27
67
  ### Global Installation (`~/.rrce-workflow/`)
28
68
 
29
69
  ```
30
70
  ~/.rrce-workflow/
31
- ├── config.yaml # User global configuration
32
- ├── templates/ # Default template store
33
- ├── meta.template.json # Task metadata template
34
- │ ├── research_output.md # Research brief template
35
- ├── planning_output.md # Execution plan template
36
- │ ├── executor_output.md # Implementation log template
37
- │ ├── documentation_output.md # Handover note template
38
- │ └── docs/ # Doc-type specific templates
39
- │ └── <doc-type>.md
40
- └── workspaces/ # Project-scoped cache
41
- └── <workspace-hash>/ # SHA256 of workspace path
42
- ├── workspace.json # Workspace metadata
43
- ├── knowledge/ # Project domain knowledge
44
- └── <domain>.md
45
- └── tasks/ # Task state and artifacts
71
+ ├── mcp.yaml # MCP server configuration (projects, permissions)
72
+ ├── preferences.json # User preferences (global path overrides)
73
+ ├── templates/ # Default template store
74
+ │ ├── meta.template.json # Task metadata template
75
+ └── docs/ # Doc-type specific templates
76
+ └── workspaces/ # Project-scoped data (Global Mode)
77
+ └── <workspace-name>/ # Named by project, not hash
78
+ ├── config.yaml # Project configuration
79
+ ├── knowledge/ # Project domain knowledge
80
+ │ ├── project-context.md # Main context file
81
+ │ ├── embeddings.json # RAG vector index
82
+ │ └── <topic>.md # Additional knowledge files
83
+ ├── refs/ # Reference documents
84
+ └── tasks/ # Task state and artifacts
46
85
  └── <task-slug>/
47
- ├── meta.json # Task metadata and status
48
- ├── research/ # Research artifacts
49
- ├── planning/ # Planning artifacts
50
- ├── execution/ # Execution logs
51
- └── docs/ # Generated documentation
86
+ ├── meta.json # Task metadata, checklist, agent status
87
+ ├── research/ # Research artifacts
88
+ ├── planning/ # Planning artifacts
89
+ ├── execution/ # Execution logs
90
+ └── docs/ # Generated documentation
52
91
  ```
53
92
 
54
- ### Workspace Configuration (Optional)
93
+ ### Workspace Mode (`.rrce-workflow/`)
55
94
 
56
95
  ```
57
96
  <workspace>/
58
- └── .rrce-workflow.yaml # Project-specific config
97
+ └── .rrce-workflow/
98
+ ├── config.yaml # Project-specific config
99
+ ├── knowledge/ # Project knowledge (same structure as global)
100
+ ├── refs/
101
+ └── tasks/
59
102
  ```
60
103
 
61
104
  ---
@@ -69,19 +112,28 @@ The system provides a structured multi-agent pipeline for software development t
69
112
  | `global` (default) | `~/.rrce-workflow/workspaces/<workspace-name>/` | Non-intrusive, survives repo deletion |
70
113
  | `workspace` | `<workspace>/.rrce-workflow/` | Portable, team-shareable |
71
114
 
72
- Configure via `.rrce-workflow.yaml`:
115
+ Configure via `config.yaml`:
73
116
  ```yaml
74
- storage:
75
- mode: global # or: workspace
117
+ mode: global # or: workspace
118
+ name: my-project
119
+ sourcePath: /path/to/source # For global mode: links data back to source
76
120
  ```
77
121
 
122
+ ### Key Path Functions (`src/lib/paths.ts`)
123
+
124
+ | Function | Purpose |
125
+ |----------|---------|
126
+ | `getEffectiveGlobalPath()` | Returns RRCE_HOME respecting user preferences |
127
+ | `getConfigPath(workspaceRoot)` | Finds config.yaml (local or global) |
128
+ | `resolveDataPath(mode, name, root)` | Resolves RRCE_DATA based on storage mode |
129
+ | `detectWorkspaceRoot()` | Walks up from CWD to find project root |
130
+
78
131
  ### Environment Variables
79
132
 
80
133
  | Variable | Purpose | Default |
81
134
  |----------|---------|---------|
82
135
  | `RRCE_HOME` | Global installation path | `~/.rrce-workflow` |
83
136
  | `RRCE_WORKSPACE` | Explicit workspace root | Auto-detected |
84
- | `RRCE_AUTHOR` | Default author name | From `config.yaml` |
85
137
 
86
138
  ### Template Variables
87
139
 
@@ -89,7 +141,7 @@ storage:
89
141
  |----------|-------------|
90
142
  | `{{RRCE_HOME}}` | Global installation path |
91
143
  | `{{RRCE_DATA}}` | Data path (based on storage mode) |
92
- | `{{WORKSPACE_ROOT}}` | Workspace directory |
144
+ | `{{WORKSPACE_ROOT}}` | Workspace directory (source code location) |
93
145
  | `{{WORKSPACE_NAME}}` | Project name (from config or directory) |
94
146
 
95
147
  ### Workspace Detection Algorithm
@@ -98,10 +150,32 @@ storage:
98
150
  1. If $RRCE_WORKSPACE is set → use it
99
151
  2. Walk up from CWD, find first directory containing:
100
152
  - .git/
101
- - .rrce-workflow.yaml
153
+ - .rrce-workflow/config.yaml (new)
154
+ - .rrce-workflow.yaml (legacy)
102
155
  3. Fall back to CWD
103
156
  ```
104
157
 
158
+ ### Project Detection (`src/lib/detection.ts`)
159
+
160
+ The `DetectedProject` interface captures:
161
+ ```typescript
162
+ interface DetectedProject {
163
+ name: string;
164
+ path: string; // Absolute path to project root
165
+ dataPath: string; // Path to .rrce-workflow data directory
166
+ source: 'global' | 'local';
167
+ sourcePath?: string; // For global mode: actual source code location
168
+ knowledgePath?: string;
169
+ tasksPath?: string;
170
+ semanticSearchEnabled?: boolean;
171
+ }
172
+ ```
173
+
174
+ Scanning priority:
175
+ 1. Known projects from MCP config (name + path)
176
+ 2. Global storage (`~/.rrce-workflow/workspaces/`)
177
+ 3. Home directory recursive scan (up to depth 5)
178
+
105
179
  ### Cross-Project References
106
180
 
107
181
  Reference another project's context when needed:
@@ -125,13 +199,13 @@ Reference another project's context when needed:
125
199
  └────────┬────────┘
126
200
 
127
201
 
128
- project-context.md
202
+ project-context.md + embeddings.json
129
203
 
130
204
  ┌────────────────────────────────────┴────────────────────────────────────┐
131
205
  ▼ │
132
206
  ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
133
207
  │ Research │────▶│ Planning │────▶│ Executor │────▶│ Documentation │
134
- & Discussion │ │ Orchestrator │ │ │ │ │
208
+ │ Discussion │ │ Discussion │ │ (Code Changes) │ │ │
135
209
  └─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
136
210
  │ │ │ │
137
211
  ▼ ▼ ▼ ▼
@@ -139,43 +213,74 @@ Reference another project's context when needed:
139
213
  │ │ │ │
140
214
  └───────────────────────┴───────────────────────┴───────────────────────┘
141
215
 
142
-
143
- {{RRCE_CACHE}}/knowledge/
144
- (Persistent Context)
216
+ ┌────────┴────────┐
217
+ ▼ ▼
218
+ {{RRCE_DATA}}/ ┌─────────────────┐
219
+ knowledge/ │ Sync │
220
+ │ (Reconciliation)│
221
+ └────────┬────────┘
222
+
223
+ ┌────────┴────────┐
224
+ ▼ ▼
225
+ Doctor (Next Task)
226
+ (Health Check)
145
227
  ```
146
228
 
147
229
  ### Agent Responsibilities
148
230
 
149
- | Agent | Role | Input | Output |
150
- |-------|------|-------|--------|
151
- | **Init** | Analyze codebase, establish project context | Workspace files | `project-context.md` |
152
- | **Research & Discussion** | Clarify requirements, surface risks | User request + context | Requirements brief |
153
- | **Planning Orchestrator** | Create actionable execution plan | Research brief | Prioritized task breakdown |
154
- | **Executor** | Implement and verify | Plan + skill scope | Code + execution log |
155
- | **Documentation** | Synthesize and handover | All artifacts | Release-ready docs |
156
- | **Sync** | Reconcile knowledge | Codebase state | Updated knowledge files |
231
+ | Agent | ID | Role | Input | Output |
232
+ |-------|-----|------|-------|--------|
233
+ | **Init** | `init` | Analyze codebase, establish project context, build RAG index | Workspace files | `project-context.md`, `embeddings.json` |
234
+ | **Research** | `research_discussion` | Interactive requirements clarification, surface risks | User request + context | Research brief |
235
+ | **Planning** | `planning_discussion` | Create actionable execution plan with checklist | Research brief | Prioritized task breakdown |
236
+ | **Executor** | `executor` | Implement and verify - ONLY agent that modifies code | Plan + skill scope | Code + execution log |
237
+ | **Documentation** | `documentation` | Synthesize and handover | All artifacts | Release-ready docs |
238
+ | **Sync** | `sync` | Reconcile knowledge with codebase state | Codebase state | Updated knowledge files |
239
+ | **Doctor** | `doctor` | Analyze codebase health using semantic search | Project + focus area | Health report, improvement tasks |
157
240
 
158
241
  ---
159
242
 
160
243
  ## Configuration
161
244
 
162
- ### Global Config (`~/.rrce-workflow/config.yaml`)
245
+ ### MCP Configuration (`~/.rrce-workflow/mcp.yaml`)
163
246
 
164
247
  ```yaml
165
- version: 1
248
+ # Projects exposed to MCP clients
249
+ projects:
250
+ - name: my-project
251
+ path: /path/to/my-project
252
+ permissions:
253
+ knowledge: true
254
+ tasks: true
255
+ prompts: true
256
+ semanticSearch:
257
+ enabled: true
258
+ model: Xenova/all-MiniLM-L6-v2
259
+ ```
166
260
 
167
- # User identity
168
- author: "your-name"
169
- email: "your@email.com"
261
+ ### Project Config (`<workspace>/.rrce-workflow/config.yaml` or global)
170
262
 
171
- # Default behaviors
172
- defaults:
173
- auto_create_workspace_cache: true
174
- sync_after_execution: false
175
-
176
- # Editor integration hints (informational)
177
- editor:
178
- preferred: "vscode" # vscode | antigravity | vim | etc.
263
+ ```yaml
264
+ name: my-project
265
+ mode: global # or: workspace
266
+ sourcePath: /path/to/source # For global mode
267
+
268
+ # Semantic search configuration
269
+ semantic_search:
270
+ enabled: true
271
+
272
+ # Cross-project linking
273
+ linked_projects:
274
+ - other-project
275
+ ```
276
+
277
+ ### User Preferences (`~/.rrce-workflow/preferences.json`)
278
+
279
+ ```json
280
+ {
281
+ "defaultGlobalPath": "/custom/path/.rrce-workflow",
282
+ "useCustomGlobalPath": true
283
+ }
179
284
  ```
180
285
 
181
286
  ### Project Config (`<workspace>/.rrce-workflow.yaml`)
@@ -205,89 +310,78 @@ author: "maintainer-name" # Overrides global config for this project
205
310
 
206
311
  ## Prompt Frontmatter Schema
207
312
 
208
- All agent prompts use YAML frontmatter for metadata and tool compatibility:
313
+ All agent prompts in `agent-core/prompts/` use YAML frontmatter for metadata:
209
314
 
210
315
  ```yaml
211
316
  ---
212
- description: Brief description of the agent's purpose
213
- argument-hint: CLI-style argument hint for display
214
- agent: agent | ask | edit # Copilot mode
215
- tools: ['search/codebase', ...] # Available Copilot tools
216
- required-args:
217
- - name: ARG_NAME
218
- prompt: "Interactive prompt if arg is missing"
219
- optional-args:
220
- - name: ARG_NAME
221
- default: "default value"
222
- auto-identity:
223
- user: "$GIT_USER" # Auto-detect from `git config user.name`
224
- model: "$AGENT_MODEL" # Auto-detect from runtime (gemini-2.0, claude-sonnet, etc.)
317
+ name: RRCE Executor
318
+ description: Execute the planned tasks to deliver working code and tests.
319
+ tools:
320
+ - read
321
+ - write
322
+ - edit
323
+ - bash
324
+ - glob
325
+ - grep
326
+ - search_knowledge # MCP tool (becomes rrce_search_knowledge in OpenCode)
327
+ - get_project_context # MCP tool
328
+ - update_task # MCP tool
329
+ arguments:
330
+ - name: TASK_SLUG
331
+ description: Enter the task slug to execute
332
+ required: true
333
+ - name: BRANCH
334
+ description: Git branch for the work
335
+ required: false
225
336
  ---
226
- ```
227
337
 
228
- ### Auto-Identity
338
+ # Agent System Prompt Content...
339
+ ```
229
340
 
230
- Identity is automatically detected - no user input required:
341
+ ### Tool Categories
231
342
 
232
- | Variable | Source | Example |
233
- |----------|--------|---------|
234
- | `$GIT_USER` | `git config user.name` | "John Doe" |
235
- | `$AGENT_MODEL` | Runtime environment | "gemini-2.0-flash", "claude-sonnet-4" |
343
+ | Category | Tools | Notes |
344
+ |----------|-------|-------|
345
+ | **Host Tools** | `read`, `write`, `edit`, `bash`, `grep`, `glob`, `webfetch` | Native to host environment |
346
+ | **MCP Tools** | `search_knowledge`, `get_project_context`, `list_tasks`, etc. | Prefixed with `rrce_` in OpenCode |
236
347
 
237
348
  ---
238
349
 
239
350
  ## Multi-Tool Integration
240
351
 
241
- RRCE-Workflow prompts are designed to work across multiple AI coding tools:
352
+ RRCE-Workflow prompts are designed to work across multiple AI coding tools via MCP and IDE-specific agent generation.
242
353
 
243
354
  ### Tool Support Matrix
244
355
 
245
- | Tool | Prompt Location | Extension | Notes |
246
- |------|----------------|-----------|-------|
247
- | **Antigravity IDE** | `.agent/workflows/` | `.md` | Native workflow support |
248
- | **OpenCode** | `.opencode/agent/` | `.md` | Custom Primary Agents |
249
- | **GitHub Copilot (VSCode)** | `.github/agents/` | `.agent.md` | Custom agents format |
250
- | **Copilot CLI** | Any location | `.md` | Reference via file path |
251
-
252
- ### Wizard Command
356
+ | Tool | MCP Config Location | Agent Location | Notes |
357
+ |------|---------------------|----------------|-------|
358
+ | **OpenCode** | `~/.config/opencode/opencode.json` | `.opencode/agent/rrce-*.md` | Custom Primary Agents (Tab to switch) |
359
+ | **Antigravity IDE** | `~/.gemini/antigravity/mcp_config.json` | `.agent/workflows/*.md` | Native workflow support |
360
+ | **GitHub Copilot (VSCode)** | `.vscode/mcp.json` or global settings | `.github/prompts/*.prompt.md` | Custom agents format |
361
+ | **Claude Desktop** | `~/.config/claude/claude_desktop_config.json` | N/A | MCP Server only |
253
362
 
254
- The TUI provides an interactive wizard to set up prompts for your preferred tools:
363
+ ### OpenCode Agent Transformation
255
364
 
256
- ```
257
- $ rrce-workflow wizard
258
-
259
- ┌─────────────────────────────────────────────────────────┐
260
- RRCE-Workflow Project Setup │
261
- ├─────────────────────────────────────────────────────────┤
262
- │ │
263
- │ Which AI tools do you use? │
264
- │ │
265
- │ [x] GitHub Copilot (VSCode) │
266
- │ [x] Antigravity IDE │
267
- │ [ ] Copilot CLI only │
268
- │ │
269
- │ ───────────────────────────────────────────────────── │
270
- │ │
271
- │ ✓ Created .github/prompts/*.prompt.md │
272
- │ ✓ Created .agent/workflows/*.md │
273
- │ ✓ Initialized project context │
274
- │ │
275
- └─────────────────────────────────────────────────────────┘
276
- ```
365
+ When generating agents for OpenCode (`src/commands/wizard/utils.ts`):
366
+ - **Mode**: Set to `primary` (enables Tab cycling in TUI)
367
+ - **Tools**:
368
+ - Host tools (`read`, `write`, `edit`, `bash`, `grep`, `glob`, `webfetch`) pass through as-is
369
+ - MCP tools are prefixed with `rrce_` (e.g., `rrce_search_knowledge`)
370
+ - Tool list respects per-agent frontmatter restrictions
371
+ - **Naming**: Agents prefixed with `rrce-` to avoid collisions
277
372
 
278
373
  ### Generated Files
279
374
 
280
- When you run `rrce-workflow wizard`, it creates:
281
-
282
- **For GitHub Copilot (VSCode):**
375
+ **For OpenCode:**
283
376
  ```
284
- .github/prompts/
285
- ├── init.prompt.md
286
- ├── research.prompt.md
287
- ├── planning.prompt.md
288
- ├── executor.prompt.md
289
- ├── documentation.prompt.md
290
- └── sync.prompt.md
377
+ .opencode/agent/
378
+ ├── rrce-init.md
379
+ ├── rrce-research.md
380
+ ├── rrce-planning.md
381
+ ├── rrce-executor.md
382
+ ├── rrce-documentation.md
383
+ ├── rrce-sync.md
384
+ └── rrce-doctor.md
291
385
  ```
292
386
 
293
387
  **For Antigravity IDE:**
@@ -298,55 +392,81 @@ When you run `rrce-workflow wizard`, it creates:
298
392
  ├── planning.md
299
393
  ├── executor.md
300
394
  ├── documentation.md
301
- └── sync.md
395
+ ├── sync.md
396
+ └── doctor.md
302
397
  ```
303
398
 
304
- **For OpenCode:**
399
+ **For GitHub Copilot (VSCode):**
305
400
  ```
306
- .opencode/agent/
307
- ├── rrce-init.md
308
- ├── rrce-research.md
309
- ├── rrce-planning.md
310
- ├── rrce-executor.md
311
- ├── rrce-documentation.md
312
- └── rrce-sync.md
401
+ .github/prompts/
402
+ ├── init.prompt.md
403
+ ├── research.prompt.md
404
+ ├── planning.prompt.md
405
+ ├── executor.prompt.md
406
+ ├── documentation.prompt.md
407
+ ├── sync.prompt.md
408
+ └── doctor.prompt.md
313
409
  ```
314
410
 
315
- ### Copilot-Specific Features
411
+ ---
412
+
413
+ ## MCP Server Architecture
414
+
415
+ The MCP Server (`src/mcp/`) provides the bridge between project knowledge and AI agents.
416
+
417
+ ### Components
418
+
419
+ | Component | Location | Purpose |
420
+ |-----------|----------|---------|
421
+ | **Server Entry** | `src/mcp/server.ts` | Initializes server, registers handlers, manages Stdio transport |
422
+ | **Tool Handlers** | `src/mcp/handlers/tools.ts` | 12 MCP tools (search, index, tasks, resolve_path, etc.) |
423
+ | **Prompt Handlers** | `src/mcp/handlers/prompts.ts` | Agent system prompts with context injection |
424
+ | **Resource Handlers** | `src/mcp/handlers/resources.ts` | Knowledge files and project context as readable resources |
425
+ | **RAG Service** | `src/mcp/services/rag.ts` | Semantic search with @xenova/transformers |
426
+ | **Resources Utilities** | `src/mcp/resources.ts` | Project data access, task CRUD, context preamble generation |
427
+
428
+ ### Context Injection
316
429
 
317
- Our prompts include Copilot-compatible frontmatter:
430
+ When an agent requests a prompt via `get_agent_prompt`, the server injects a **Context Preamble** containing:
431
+ - **System Resolved Paths**: Pre-resolved `RRCE_DATA`, `WORKSPACE_ROOT`, `RRCE_HOME`
432
+ - **Available Projects**: List of exposed projects with active project marked
433
+ - **Active Workspace**: Current project context for file operations
318
434
 
319
- | Field | Purpose | Values |
320
- |-------|---------|--------|
321
- | `agent` | Execution mode | `agent` (full), `ask` (read-only), `edit` (code changes) |
322
- | `tools` | Available tools | `search/codebase`, `search/web`, `terminalLastCommand`, etc. |
435
+ ### Semantic Search (RAG)
436
+
437
+ | Feature | Implementation |
438
+ |---------|----------------|
439
+ | **Embedding Model** | `Xenova/all-MiniLM-L6-v2` (configurable) |
440
+ | **Index Location** | `<knowledge>/embeddings.json` |
441
+ | **Similarity** | Cosine similarity |
442
+ | **Indexable Extensions** | `.ts`, `.tsx`, `.js`, `.py`, `.go`, `.rs`, `.md`, etc. |
443
+ | **Skip Directories** | `node_modules`, `.git`, `dist`, `build`, etc. |
323
444
 
324
445
  ---
325
446
 
326
- ## Installation Flow (TUI First Run)
447
+ ## Installation Flow
327
448
 
449
+ ```bash
450
+ # Option 1: MCP Dashboard (recommended)
451
+ npx rrce-workflow mcp
452
+
453
+ # Option 2: Project Setup Wizard
454
+ cd your-project
455
+ npx rrce-workflow
456
+
457
+ # Option 3: Start MCP Server directly (for IDE config)
458
+ npx rrce-workflow mcp start
328
459
  ```
329
- $ npx rrce-workflow
330
-
331
- ┌─────────────────────────────────────────────────────────┐
332
- │ RRCE-Workflow Setup Wizard │
333
- ├─────────────────────────────────────────────────────────┤
334
- │ │
335
- │ Welcome! Let's configure your workflow environment. │
336
- │ │
337
- │ Your name: [_________________] │
338
- │ Email (optional): [_________________] │
339
- │ │
340
- │ ───────────────────────────────────────────────────── │
341
- │ │
342
- │ ✓ Created ~/.rrce-workflow/config.yaml │
343
- │ ✓ Installed default templates │
344
- │ ✓ Ready to use! │
345
- │ │
346
- │ Run `rrce-workflow help` for available commands. │
347
- │ │
348
- └─────────────────────────────────────────────────────────┘
349
- ```
460
+
461
+ ---
462
+
463
+ ## Key Design Patterns
464
+
465
+ 1. **MCP Decoupling**: Handlers separated from server instance for maintainability
466
+ 2. **TUI/MCP Separation**: MCP runs in "interactive" mode to avoid stdio conflicts with TUI
467
+ 3. **Prompt Parsing**: Frontmatter-based prompts with variable injection
468
+ 4. **Hybrid Storage**: Global mode (clean repos) vs Workspace mode (portable)
469
+ 5. **DetectedProject.sourcePath**: For global mode, links data back to actual source location
350
470
 
351
471
  ---
352
472
 
@@ -355,5 +475,7 @@ $ npx rrce-workflow
355
475
  - [ ] Web UI for knowledge browsing
356
476
  - [ ] Cross-project knowledge sharing (opt-in)
357
477
  - [ ] Plugin system for custom agents
358
- - [ ] LLM-agnostic (support OpenAI, Anthropic, Gemini, local models)
478
+ - [ ] Comprehensive test suite (Jest/Vitest)
479
+ - [ ] CI/CD with GitHub Actions
480
+ - [ ] Cross-platform parity (Windows/macOS)
359
481
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrce-workflow",
3
- "version": "0.2.91",
3
+ "version": "0.2.92",
4
4
  "description": "RRCE-Workflow TUI - Agentic code workflow generator for AI-assisted development",
5
5
  "author": "RRCE Team",
6
6
  "license": "MIT",
@@ -39,7 +39,10 @@
39
39
  "wizard": "npx tsx src/index.ts wizard",
40
40
  "start": "npx tsx src/index.ts",
41
41
  "build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --packages=external",
42
- "prepublishOnly": "npm run build"
42
+ "prepublishOnly": "npm run build",
43
+ "test": "vitest run",
44
+ "test:watch": "vitest",
45
+ "test:coverage": "vitest run --coverage"
43
46
  },
44
47
  "engines": {
45
48
  "node": ">=18"
@@ -62,8 +65,10 @@
62
65
  "devDependencies": {
63
66
  "@types/node": "^25.0.3",
64
67
  "@types/react": "^19.2.7",
68
+ "@vitest/coverage-v8": "^4.0.16",
65
69
  "esbuild": "^0.27.2",
66
70
  "tsx": "^4.21.0",
67
- "typescript": "^5.9.3"
71
+ "typescript": "^5.9.3",
72
+ "vitest": "^4.0.16"
68
73
  }
69
74
  }