@putervision/agent-reasoning-mcp 0.1.1
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/CONTRIBUTING.md +7 -0
- package/LICENSE +21 -0
- package/PROJECT_INSTRUCTIONS_TEMPLATE.md +9 -0
- package/README.md +95 -0
- package/SECURITY.md +11 -0
- package/dist/chunk-2UKYRERH.js +403 -0
- package/dist/chunk-2UKYRERH.js.map +1 -0
- package/dist/chunk-6CYLIFQX.js +442 -0
- package/dist/chunk-6CYLIFQX.js.map +1 -0
- package/dist/chunk-6EWSPFTX.js +1541 -0
- package/dist/chunk-6EWSPFTX.js.map +1 -0
- package/dist/chunk-F4TEZ2TS.js +615 -0
- package/dist/chunk-F4TEZ2TS.js.map +1 -0
- package/dist/chunk-SOCPGFU4.js +538 -0
- package/dist/chunk-SOCPGFU4.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +169 -0
- package/dist/cli.js.map +1 -0
- package/dist/db-EL7JURVI.js +35 -0
- package/dist/db-EL7JURVI.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/init-JCBP646U.js +15 -0
- package/dist/init-JCBP646U.js.map +1 -0
- package/dist/lib.d.ts +1003 -0
- package/dist/lib.js +237 -0
- package/dist/lib.js.map +1 -0
- package/glama.json +42 -0
- package/manifest.json +26 -0
- package/package.json +119 -0
- package/server.json +42 -0
package/CONTRIBUTING.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PuterVision
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Agent Instructions for agent-reasoning-mcp
|
|
2
|
+
|
|
3
|
+
This project uses `@putervision/agent-reasoning-mcp` for strategic BDI reasoning.
|
|
4
|
+
|
|
5
|
+
## Mandatory Workflow
|
|
6
|
+
1. **Goals**: Call `set_goal(create)` before beginning complex work.
|
|
7
|
+
2. **Evaluation**: Call `evaluate_situation(snapshot)` to score trade-offs against active utility weights.
|
|
8
|
+
3. **Intentions**: Dispatch execution directives with `manage_intentions(create)` for runtime execution.
|
|
9
|
+
4. **Replanning**: If blocked, call `replan(blocker)` to generate fallback DAGs.
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @putervision/agent-reasoning-mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@putervision/agent-reasoning-mcp)
|
|
4
|
+
[](https://github.com/putervision/agent-reasoning-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
> **Strategic BDI Reasoning, Multi-Attribute Expected Utility Theory & Decision Intelligence for Autonomous AI Agents**
|
|
9
|
+
|
|
10
|
+
`@putervision/agent-reasoning-mcp` is a formal Model Context Protocol (MCP) server that provides strategic belief-desire-intention (BDI) reasoning, hierarchical goal decomposition, multi-attribute expected utility calculation (\(E[U] = \sum w_i u_i\)), exponential belief decay, quantitative risk evaluation, and reactive replanning across multi-modal memory bridges.
|
|
11
|
+
|
|
12
|
+
š **Official Documentation**: [putervision.com](https://putervision.com) ⢠[Interactive Web Docs](docs/index.html)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## ā” 15-Second Quick Start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 1. Initialize reasoning database & seed default utility profiles
|
|
20
|
+
npx @putervision/agent-reasoning-mcp init
|
|
21
|
+
|
|
22
|
+
# 2. Run health diagnostics and Merkle audit checks
|
|
23
|
+
npx @putervision/agent-reasoning-mcp doctor
|
|
24
|
+
|
|
25
|
+
# 3. Inspect active goals, intentions, and belief states
|
|
26
|
+
npx @putervision/agent-reasoning-mcp inspect
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## š ļø 10 Core MCP Tools
|
|
32
|
+
|
|
33
|
+
| Tool | Actions | Purpose |
|
|
34
|
+
|------|---------|---------|
|
|
35
|
+
| `set_goal` | `create`, `update`, `decompose`, `get`, `list`, `abandon` | Manage goal hierarchy, task DAGs, and success criteria |
|
|
36
|
+
| `evaluate_situation` | `snapshot`, `quick` | Score and rank candidate actions from environment snapshots |
|
|
37
|
+
| `replan` | `blocker`, `event`, `full` | Adaptively reconstruct subgoals upon obstacles and abort stale intentions |
|
|
38
|
+
| `assess_risk` | `action`, `plan`, `compare` | Quantitative threat and risk calculation across candidate actions |
|
|
39
|
+
| `query_knowledge` | `search`, `patterns`, `similar_situations` | Search learned heuristics, tactical knowledge, and past decision patterns |
|
|
40
|
+
| `set_utility_weights` | `configure`, `get`, `list`, `activate` | Configure utility weights (aggression, caution, greed, efficiency, exploration) |
|
|
41
|
+
| `get_decision_trace` | `latest`, `get`, `list`, `explain` | Explainable chain-of-thought rationale and latency telemetry |
|
|
42
|
+
| `manage_beliefs` | `update`, `query`, `expire`, `reconcile` | Structured belief state with exponential confidence decay ($C = C_0 e^{-\lambda t}$) |
|
|
43
|
+
| `manage_intentions` | `create`, `dispatch`, `get`, `list`, `cancel`, `resolve` | Wire contract directives queue for runtime execution engines |
|
|
44
|
+
| `manage_reasoning_db` | `stats`, `audit`, `snapshot`, `restore` | Reasoning database statistics, SHA-256 Merkle audit, and snapshot rollback |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## šļø PuterVision Pentad Multi-Modal Ecosystem
|
|
49
|
+
|
|
50
|
+
`agent-reasoning-mcp` coordinates the closed-loop **PuterVision Super-Loop**:
|
|
51
|
+
- š§ **`agent-reasoning-mcp`**: Decides *what* to do (BDI Strategic Reasoning, Utility Theory, Replanning)
|
|
52
|
+
- ā” **`behavior-mcp`**: Executes *how* to act at ~60Hz in browser runtimes
|
|
53
|
+
- š **`state-memory-mcp`**: Durable workflow memory, tasks, blockers, decisions
|
|
54
|
+
- šļø **`vision-memory-mcp`**: Perceptual caching, visual grounding, video timelines
|
|
55
|
+
- š **`world-model-mcp`**: 3D/2D spatial layout, entity permanence, collision simulation
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## š Deep Documentation Guides
|
|
60
|
+
|
|
61
|
+
- š **[Formal API Reference](docs/api-reference.md)**: Full parameter tables, type definitions, and tool schemas.
|
|
62
|
+
- š” **[Core Architecture & Concepts](docs/concepts.md)**: BDI model, utility formulation, and belief decay dynamics.
|
|
63
|
+
- š„ļø **[CLI Usage Guide](docs/cli-usage.md)**: Complete CLI command reference (`init`, `doctor`, `inspect`, `run`).
|
|
64
|
+
- š¾ **[Database Schema](docs/database-schema.md)**: SQLite table structures, indexes, and Merkle audit ledger.
|
|
65
|
+
- āļø **[Configuration Reference](docs/configuration.md)**: `.agent-reasoning-mcp.json` parameters and environment variables.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## š Client Configuration
|
|
70
|
+
|
|
71
|
+
Add to `.cursor/mcp.json` or `.vscode/mcp.json`:
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"agent-reasoning-mcp": {
|
|
76
|
+
"command": "agent-reasoning-mcp",
|
|
77
|
+
"args": ["run"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## š§Ŗ Testing
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Run full unit and integration test suite across 16 test files (68 tests)
|
|
89
|
+
npm test
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## š License
|
|
95
|
+
MIT Ā© PuterVision
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | ------------------ |
|
|
7
|
+
| 0.1.x | :white_check_mark: |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
If you discover a security vulnerability, please report it via private security advisory on GitHub or email security@putervision.org. Please do not open public issues for security vulnerabilities.
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KnowledgeEngine,
|
|
3
|
+
UtilityProfileEngine,
|
|
4
|
+
verifyEventChain
|
|
5
|
+
} from "./chunk-6CYLIFQX.js";
|
|
6
|
+
import {
|
|
7
|
+
getDb,
|
|
8
|
+
getProjectSlug,
|
|
9
|
+
logger,
|
|
10
|
+
registerProject,
|
|
11
|
+
resolveProjectRoot
|
|
12
|
+
} from "./chunk-F4TEZ2TS.js";
|
|
13
|
+
|
|
14
|
+
// src/cli/init.ts
|
|
15
|
+
import * as fs from "fs";
|
|
16
|
+
import * as path from "path";
|
|
17
|
+
import * as os from "os";
|
|
18
|
+
|
|
19
|
+
// src/cli/templates.ts
|
|
20
|
+
function getAgentsMdTemplate(projectSlug = "default") {
|
|
21
|
+
return `<!-- agent-reasoning-mcp:start -->
|
|
22
|
+
# Strategic Agent Reasoning (agent-reasoning-mcp)
|
|
23
|
+
|
|
24
|
+
This project uses \`agent-reasoning-mcp\` with project slug "${projectSlug}" to manage goals, decompose complex tasks, evaluate situational trade-offs, and track decision rationale.
|
|
25
|
+
|
|
26
|
+
## Mandatory Reasoning Workflow
|
|
27
|
+
1. **Start of planning**: Call \`set_goal(action: "create", title: "...")\` to establish high-level objectives.
|
|
28
|
+
2. **Decomposition**: Call \`set_goal(action: "decompose", parent_id: "...", subgoals: [...])\` to break down into actionable steps.
|
|
29
|
+
3. **Situational Trade-offs**: Call \`evaluate_situation(action: "snapshot", snapshot: {...})\` before selecting high-stakes actions.
|
|
30
|
+
4. **Utility Configuration**: Tune agent priorities with \`set_utility_weights(action: "configure", weights: {...})\`.
|
|
31
|
+
5. **Intention Dispatch**: Create execution directives with \`manage_intentions(action: "create", ...)\` for the runtime engine.
|
|
32
|
+
6. **Reactive Replanning**: If an unexpected blocker occurs, invoke \`replan(action: "blocker", goal_id: "...", blocker_description: "...")\`.
|
|
33
|
+
|
|
34
|
+
## 10 Core MCP Tools
|
|
35
|
+
- \`set_goal\`: Manage goal hierarchy and task DAGs.
|
|
36
|
+
- \`evaluate_situation\`: Score and rank candidate actions from environment snapshots.
|
|
37
|
+
- \`replan\`: Adaptively reconstruct subgoals upon obstacles.
|
|
38
|
+
- \`assess_risk\`: Quantitative threat and risk calculation.
|
|
39
|
+
- \`query_knowledge\`: Search heuristics and past decision patterns.
|
|
40
|
+
- \`set_utility_weights\`: Configure utility weights (aggression, caution, greed, exploration).
|
|
41
|
+
- \`get_decision_trace\`: Explainable chain-of-thought rationale playback.
|
|
42
|
+
- \`manage_beliefs\`: Structured belief state with exponential confidence decay.
|
|
43
|
+
- \`manage_intentions\`: Wire contract directives queue for runtime execution.
|
|
44
|
+
- \`manage_reasoning_db\`: Snapshots, diagnostics, and SHA-256 Merkle audit verification.
|
|
45
|
+
<!-- agent-reasoning-mcp:end -->
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
function getInstructionsTemplate(projectSlug) {
|
|
49
|
+
return getAgentsMdTemplate(projectSlug);
|
|
50
|
+
}
|
|
51
|
+
function getGlobalRulesTemplate(projectSlug) {
|
|
52
|
+
return `<!-- agent-reasoning-mcp:start -->
|
|
53
|
+
# Strategic Agent Reasoning (agent-reasoning-mcp)
|
|
54
|
+
|
|
55
|
+
This project uses agent-reasoning-mcp with project slug "${projectSlug}" for BDI decision intelligence.
|
|
56
|
+
ALWAYS evaluate situation snapshots against active utility weights before taking high-stakes actions.
|
|
57
|
+
|
|
58
|
+
## Mandatory Workflow
|
|
59
|
+
1. **Goals**: Call \`set_goal\` to track objectives.
|
|
60
|
+
2. **Evaluation**: Call \`evaluate_situation\` for candidate action scoring.
|
|
61
|
+
3. **Intentions**: Dispatch execution directives via \`manage_intentions\`.
|
|
62
|
+
4. **Replanning**: Call \`replan\` when blocked.
|
|
63
|
+
<!-- agent-reasoning-mcp:end -->
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
function getMcpConfigCursor(projectSlug) {
|
|
67
|
+
return {
|
|
68
|
+
mcpServers: {
|
|
69
|
+
"agent-reasoning-mcp": {
|
|
70
|
+
command: "agent-reasoning-mcp",
|
|
71
|
+
args: ["run"],
|
|
72
|
+
env: {
|
|
73
|
+
REASONING_PROJECT: projectSlug
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function getMcpConfigVscode(projectSlug) {
|
|
80
|
+
return {
|
|
81
|
+
servers: {
|
|
82
|
+
"agent-reasoning-mcp": {
|
|
83
|
+
type: "stdio",
|
|
84
|
+
command: "agent-reasoning-mcp",
|
|
85
|
+
args: ["run"],
|
|
86
|
+
env: {
|
|
87
|
+
REASONING_PROJECT: projectSlug
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function getMcpConfigAntigravity() {
|
|
94
|
+
return {
|
|
95
|
+
mcpServers: {
|
|
96
|
+
"agent-reasoning-mcp": {
|
|
97
|
+
command: "agent-reasoning-mcp",
|
|
98
|
+
args: ["run"]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function getSkillTemplate(projectSlug) {
|
|
104
|
+
return `---
|
|
105
|
+
name: agent-reasoning-mcp
|
|
106
|
+
description: Teaches the agent to use the Strategic Agent Reasoning MCP server for BDI goals, utility scoring, risk evaluation, and replanning.
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
# Strategic Agent Reasoning (agent-reasoning-mcp)
|
|
110
|
+
|
|
111
|
+
This skill provides step-by-step guidance and operational patterns for interacting with \`@putervision/agent-reasoning-mcp\` with project slug \`"${projectSlug}"\`.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 1. Role in the PuterVision Pentad
|
|
116
|
+
- **Workflow State** (\`state-memory-mcp\`): Persistent task DAGs, decisions, milestones, and blockers.
|
|
117
|
+
- **Perception** (\`vision-memory-mcp\`): Visual layout caching, screenshots, and visual specifications.
|
|
118
|
+
- **Spatial World** (\`world-model-mcp\`): Persistent 3D/2D coordinates, bounding boxes, and topological relations.
|
|
119
|
+
- **Strategic Reasoning** (\`agent-reasoning-mcp\`): BDI goal decomposition, multi-attribute expected utility calculation, belief decay, risk assessment, and replanning.
|
|
120
|
+
- **Tactical Execution** (\`behavior-mcp\`): Deterministic ~60Hz browser behavior tree execution and reactive preemption.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 2. Core Operational Sequence
|
|
125
|
+
1. **Initialize Objectives**: Call \`set_goal\` with \`action: "create"\` to define top-level goals and \`action: "decompose"\` to establish subgoals.
|
|
126
|
+
2. **Configure Utility Profile**: Tune agent priorities using \`set_utility_weights\` (aggression, caution, greed, exploration).
|
|
127
|
+
3. **Situational Trade-off Scoring**: Call \`evaluate_situation\` with \`action: "snapshot"\` to rank candidate actions using Pareto utility theory.
|
|
128
|
+
4. **Intention Dispatch**: Translate chosen action into an execution directive via \`manage_intentions\`.
|
|
129
|
+
5. **Reactive Replanning**: If an unexpected obstacle or blocker emerges, invoke \`replan\`.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 3. Complete 10 Consolidated MCP Tools Reference
|
|
134
|
+
|
|
135
|
+
| Tool Name | Key Actions | Key Parameters | Description |
|
|
136
|
+
|---|---|---|---|
|
|
137
|
+
| \`set_goal\` | \`create\`, \`update\`, \`get\`, \`list\`, \`decompose\`, \`archive\` | \`title\`, \`description\`, \`priority\`, \`parent_id\`, \`subgoals\` | Hierarchical BDI goal management and task DAG decomposition. |
|
|
138
|
+
| \`evaluate_situation\` | \`snapshot\`, \`quick\` | \`snapshot\`, \`candidates\`, \`utility_profile\` | Multi-attribute utility evaluation ranking candidate actions from environment state. |
|
|
139
|
+
| \`replan\` | \`blocker\`, \`recovery\`, \`alternative\` | \`goal_id\`, \`blocker_description\`, \`strategy\` | Adaptive DAG reconstruction and alternative path discovery upon obstacles. |
|
|
140
|
+
| \`assess_risk\` | \`assess\`, \`matrix\` | \`hazards\`, \`tolerance\`, \`mitigations\` | Quantitative threat matrix and probabilistic risk scoring. |
|
|
141
|
+
| \`query_knowledge\` | \`search\`, \`lookup\`, \`heuristics\` | \`query\`, \`category\`, \`tags\` | Knowledge retrieval of past decision heuristics and domain heuristics. |
|
|
142
|
+
| \`set_utility_weights\` | \`configure\`, \`get\`, \`list\`, \`profile\` | \`name\`, \`weights\` (aggression, caution, greed, exploration) | Utility weight tuning and personality profile management. |
|
|
143
|
+
| \`get_decision_trace\` | \`get\`, \`list\`, \`explain\` | \`trace_id\`, \`limit\` | Explainable chain-of-thought rationale playback and auditing. |
|
|
144
|
+
| \`manage_beliefs\` | \`set\`, \`get\`, \`decay\`, \`list\` | \`key\`, \`value\`, \`confidence\`, \`decay_rate\` | Structured belief state with temporal exponential confidence decay. |
|
|
145
|
+
| \`manage_intentions\` | \`create\`, \`get\`, \`list\`, \`dispatch\`, \`cancel\` | \`goal_id\`, \`behavior_name\`, \`parameters\` | Execution directives queue connecting strategic plans to runtime engines. |
|
|
146
|
+
| \`manage_reasoning_db\` | \`stats\`, \`audit\`, \`snapshot\`, \`restore\`, \`prune\` | \`action\`, \`name\`, \`description\` | Database diagnostics, snapshots, and SHA-256 Merkle audit verification. |
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/cli/init.ts
|
|
151
|
+
function upsertInstructionBlock(content, newBlock, startMarker = "<!-- agent-reasoning-mcp:start -->", endMarker = "<!-- agent-reasoning-mcp:end -->") {
|
|
152
|
+
const startIndex = content.indexOf(startMarker);
|
|
153
|
+
const endIndex = content.indexOf(endMarker);
|
|
154
|
+
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
|
|
155
|
+
const before = content.substring(0, startIndex);
|
|
156
|
+
const after = content.substring(endIndex + endMarker.length);
|
|
157
|
+
const existingBlock = content.substring(startIndex, endIndex + endMarker.length);
|
|
158
|
+
if (existingBlock.trim() === newBlock.trim()) {
|
|
159
|
+
return { updatedContent: content, status: "unchanged" };
|
|
160
|
+
}
|
|
161
|
+
return { updatedContent: `${before}${newBlock.trim()}${after}`, status: "updated" };
|
|
162
|
+
}
|
|
163
|
+
const separator = content.endsWith("\n") ? "\n" : "\n\n";
|
|
164
|
+
return { updatedContent: `${content}${separator}${newBlock.trim()}
|
|
165
|
+
`, status: "appended" };
|
|
166
|
+
}
|
|
167
|
+
function mergeMcpConfig(root, relativePath, label, template, serversKey) {
|
|
168
|
+
const filePath = path.join(root, relativePath);
|
|
169
|
+
const dir = path.dirname(filePath);
|
|
170
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
171
|
+
if (fs.existsSync(filePath)) {
|
|
172
|
+
try {
|
|
173
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
174
|
+
const existing = JSON.parse(raw);
|
|
175
|
+
if (existing[serversKey]?.["agent-reasoning-mcp"]) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (!existing[serversKey]) existing[serversKey] = {};
|
|
179
|
+
existing[serversKey]["agent-reasoning-mcp"] = template[serversKey]["agent-reasoning-mcp"];
|
|
180
|
+
fs.writeFileSync(filePath, JSON.stringify(existing, null, 2) + "\n", "utf-8");
|
|
181
|
+
} catch {
|
|
182
|
+
fs.writeFileSync(filePath, JSON.stringify(template, null, 2) + "\n", "utf-8");
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
fs.writeFileSync(filePath, JSON.stringify(template, null, 2) + "\n", "utf-8");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function runInit(options = {}) {
|
|
189
|
+
const cwd = options.cwd || process.cwd();
|
|
190
|
+
const root = options.project ? resolveProjectRoot(options.project, cwd) : path.resolve(cwd);
|
|
191
|
+
const slug = options.project ? getProjectSlug(options.project, cwd) : getProjectSlug(void 0, root);
|
|
192
|
+
console.log("\n\u{1F9E0} Initializing agent-reasoning-mcp...\n");
|
|
193
|
+
registerProject(slug, root);
|
|
194
|
+
console.log(` \u{1F4C1} Registered project "${slug}" in global registry (${root})`);
|
|
195
|
+
const dataDir = path.join(root, ".agent-reasoning-mcp", slug);
|
|
196
|
+
if (!fs.existsSync(dataDir)) {
|
|
197
|
+
fs.mkdirSync(dataDir, { recursive: true, mode: 448 });
|
|
198
|
+
}
|
|
199
|
+
console.log(` \u{1F4E6} Created local storage directory: .agent-reasoning-mcp/${slug}`);
|
|
200
|
+
const gitignorePath = path.join(root, ".gitignore");
|
|
201
|
+
const ignoreEntry = ".agent-reasoning-mcp";
|
|
202
|
+
if (fs.existsSync(gitignorePath)) {
|
|
203
|
+
const content = fs.readFileSync(gitignorePath, "utf-8");
|
|
204
|
+
if (!content.includes(ignoreEntry)) {
|
|
205
|
+
fs.appendFileSync(gitignorePath, `
|
|
206
|
+
${ignoreEntry}
|
|
207
|
+
`, "utf-8");
|
|
208
|
+
console.log(` \u{1F6E1}\uFE0F Updated .gitignore (${ignoreEntry})`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const instructions = getInstructionsTemplate(slug);
|
|
212
|
+
const targets = [
|
|
213
|
+
".agents/AGENTS.md",
|
|
214
|
+
"CLAUDE.md",
|
|
215
|
+
".windsurfrules",
|
|
216
|
+
".cursor/rules/agent-reasoning-mcp.mdc",
|
|
217
|
+
".gemini/instructions.md",
|
|
218
|
+
".vscode/instructions.md",
|
|
219
|
+
".github/copilot-instructions.md"
|
|
220
|
+
];
|
|
221
|
+
console.log(" \u{1F4DD} Scaffolding agent instruction contracts:");
|
|
222
|
+
for (const t of targets) {
|
|
223
|
+
const fullPath = path.join(root, t);
|
|
224
|
+
const dir = path.dirname(fullPath);
|
|
225
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
226
|
+
if (fs.existsSync(fullPath)) {
|
|
227
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
228
|
+
const { updatedContent, status } = upsertInstructionBlock(content, instructions);
|
|
229
|
+
fs.writeFileSync(fullPath, updatedContent, "utf-8");
|
|
230
|
+
console.log(` - ${t} (${status})`);
|
|
231
|
+
} else {
|
|
232
|
+
fs.writeFileSync(fullPath, instructions.trim() + "\n", "utf-8");
|
|
233
|
+
console.log(` - ${t} (created)`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const skillContent = getSkillTemplate(slug);
|
|
237
|
+
const localSkillDir = path.join(root, ".agents/skills/agent-reasoning-mcp");
|
|
238
|
+
if (!fs.existsSync(localSkillDir)) fs.mkdirSync(localSkillDir, { recursive: true });
|
|
239
|
+
fs.writeFileSync(path.join(localSkillDir, "SKILL.md"), skillContent, "utf-8");
|
|
240
|
+
const homedir2 = os.homedir();
|
|
241
|
+
const globalSkillDir = path.join(homedir2, ".gemini/config/skills/agent-reasoning-mcp");
|
|
242
|
+
try {
|
|
243
|
+
if (!fs.existsSync(globalSkillDir)) fs.mkdirSync(globalSkillDir, { recursive: true });
|
|
244
|
+
fs.writeFileSync(path.join(globalSkillDir, "SKILL.md"), skillContent, "utf-8");
|
|
245
|
+
} catch {
|
|
246
|
+
}
|
|
247
|
+
console.log(" \u{1F9E0} Installed Antigravity agent skill at: .agents/skills/agent-reasoning-mcp");
|
|
248
|
+
mergeMcpConfig(root, ".cursor/mcp.json", "Cursor", getMcpConfigCursor(slug), "mcpServers");
|
|
249
|
+
mergeMcpConfig(root, ".vscode/mcp.json", "VS Code", getMcpConfigVscode(slug), "servers");
|
|
250
|
+
const windsurfDir = path.join(root, ".windsurf");
|
|
251
|
+
if (fs.existsSync(windsurfDir)) {
|
|
252
|
+
mergeMcpConfig(root, ".windsurf/mcp.json", "Windsurf", getMcpConfigCursor(slug), "mcpServers");
|
|
253
|
+
}
|
|
254
|
+
const claudeDir = process.platform === "darwin" ? path.join(homedir2, "Library", "Application Support", "Claude") : process.platform === "win32" ? path.join(process.env.APPDATA || path.join(homedir2, "AppData", "Roaming"), "Claude") : path.join(homedir2, ".config", "Claude");
|
|
255
|
+
if (fs.existsSync(claudeDir)) {
|
|
256
|
+
mergeMcpConfig(
|
|
257
|
+
claudeDir,
|
|
258
|
+
"claude_desktop_config.json",
|
|
259
|
+
"Claude Desktop",
|
|
260
|
+
getMcpConfigCursor(slug),
|
|
261
|
+
"mcpServers"
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
const globalMcpConfig = path.join(homedir2, ".gemini/config/mcp_config.json");
|
|
265
|
+
try {
|
|
266
|
+
if (fs.existsSync(path.dirname(globalMcpConfig))) {
|
|
267
|
+
mergeMcpConfig(
|
|
268
|
+
homedir2,
|
|
269
|
+
".gemini/config/mcp_config.json",
|
|
270
|
+
"Antigravity",
|
|
271
|
+
getMcpConfigAntigravity(),
|
|
272
|
+
"mcpServers"
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
const geminiConfigJson = path.join(homedir2, ".gemini/config/config.json");
|
|
276
|
+
if (fs.existsSync(geminiConfigJson)) {
|
|
277
|
+
try {
|
|
278
|
+
const raw = fs.readFileSync(geminiConfigJson, "utf-8");
|
|
279
|
+
const data = JSON.parse(raw);
|
|
280
|
+
if (data.userSettings?.globalPermissionGrants?.allow) {
|
|
281
|
+
let updated = false;
|
|
282
|
+
for (const perm of ["command(agent-reasoning-mcp)"]) {
|
|
283
|
+
if (!data.userSettings.globalPermissionGrants.allow.includes(perm)) {
|
|
284
|
+
data.userSettings.globalPermissionGrants.allow.push(perm);
|
|
285
|
+
updated = true;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (updated) {
|
|
289
|
+
fs.writeFileSync(geminiConfigJson, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
290
|
+
console.log(
|
|
291
|
+
" \u2705 Google Antigravity (config.json) \u2014 granted command(agent-reasoning-mcp)"
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
} catch {
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
console.log(
|
|
301
|
+
" \u{1F50C} Configured IDE MCP Servers (Cursor, VS Code, Windsurf, Claude Desktop, Antigravity)"
|
|
302
|
+
);
|
|
303
|
+
const globalTargets = [
|
|
304
|
+
{ path: path.join(homedir2, ".cursorrules"), label: "Global Cursor Rules (~/.cursorrules)" },
|
|
305
|
+
{
|
|
306
|
+
path: path.join(homedir2, ".gemini/GEMINI.md"),
|
|
307
|
+
label: "Global Gemini Rules (~/.gemini/GEMINI.md)"
|
|
308
|
+
}
|
|
309
|
+
];
|
|
310
|
+
const globalRulesText = getGlobalRulesTemplate(slug);
|
|
311
|
+
for (const target of globalTargets) {
|
|
312
|
+
if (target.path.includes(".gemini") && !fs.existsSync(path.dirname(target.path))) {
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (fs.existsSync(target.path)) {
|
|
316
|
+
const content = fs.readFileSync(target.path, "utf-8");
|
|
317
|
+
const { updatedContent, status } = upsertInstructionBlock(content, globalRulesText);
|
|
318
|
+
if (status !== "unchanged") {
|
|
319
|
+
fs.writeFileSync(target.path, updatedContent, "utf-8");
|
|
320
|
+
console.log(` \u2705 ${target.label} \u2014 ${status} rules`);
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
fs.writeFileSync(target.path, globalRulesText, "utf-8");
|
|
324
|
+
console.log(` \u2705 ${target.label} \u2014 created`);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const db = getDb(slug, root);
|
|
328
|
+
console.log(" \u{1F4BE} Initialized SQLite database with WAL mode & SHA-256 Merkle audit chain");
|
|
329
|
+
const profiles = UtilityProfileEngine.listProfiles(db, slug);
|
|
330
|
+
if (profiles.length <= 1) {
|
|
331
|
+
UtilityProfileEngine.configureProfile(db, {
|
|
332
|
+
project: slug,
|
|
333
|
+
name: "aggressive",
|
|
334
|
+
description: "High combat and threat engagement bias",
|
|
335
|
+
weights: {
|
|
336
|
+
aggression: 0.9,
|
|
337
|
+
caution: 0.2,
|
|
338
|
+
greed: 0.5,
|
|
339
|
+
efficiency: 0.8,
|
|
340
|
+
exploration: 0.6,
|
|
341
|
+
cooperation: 0.4
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
UtilityProfileEngine.configureProfile(db, {
|
|
345
|
+
project: slug,
|
|
346
|
+
name: "cautious",
|
|
347
|
+
description: "High defense and risk aversion bias",
|
|
348
|
+
weights: {
|
|
349
|
+
aggression: 0.1,
|
|
350
|
+
caution: 0.95,
|
|
351
|
+
greed: 0.3,
|
|
352
|
+
efficiency: 0.7,
|
|
353
|
+
exploration: 0.4,
|
|
354
|
+
cooperation: 0.8
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
console.log(" \u{1F331} Seeded standard utility scoring profiles (balanced, aggressive, cautious)");
|
|
358
|
+
}
|
|
359
|
+
const seededPatterns = KnowledgeEngine.seedDefaultPatterns(db, slug);
|
|
360
|
+
if (seededPatterns > 0) {
|
|
361
|
+
console.log(` \u{1F331} Seeded ${seededPatterns} tactical gaming & navigation knowledge patterns`);
|
|
362
|
+
}
|
|
363
|
+
const audit = verifyEventChain(db, slug);
|
|
364
|
+
console.log(
|
|
365
|
+
` \u{1F50D} Audited cryptographic event ledger: ${audit.valid ? "\u2705 Unbroken SHA-256 chain" : "\u26A0\uFE0F Verification anomaly"}`
|
|
366
|
+
);
|
|
367
|
+
console.log(`
|
|
368
|
+
\u2728 agent-reasoning-mcp initialized successfully for "${slug}"!`);
|
|
369
|
+
console.log(' Run "agent-reasoning-mcp doctor" to verify runtime health.');
|
|
370
|
+
console.log(' Run "agent-reasoning-mcp inspect" to view goals, beliefs, and traces.\n');
|
|
371
|
+
}
|
|
372
|
+
async function runAutoInit(root, projectSlug) {
|
|
373
|
+
const originalLog = console.log;
|
|
374
|
+
console.log = (...args) => console.error(...args);
|
|
375
|
+
try {
|
|
376
|
+
runInit({ project: projectSlug, cwd: root });
|
|
377
|
+
} catch (err) {
|
|
378
|
+
logger.warn(`Auto-init skipped: ${err.message}`);
|
|
379
|
+
} finally {
|
|
380
|
+
console.log = originalLog;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
async function runInitGlobal() {
|
|
384
|
+
const { getRegistry } = await import("./db-EL7JURVI.js");
|
|
385
|
+
const registry = getRegistry();
|
|
386
|
+
const entries = Object.entries(registry);
|
|
387
|
+
console.log(`Running global init across ${entries.length} registered project(s)...`);
|
|
388
|
+
for (const [slug, projectRoot] of entries) {
|
|
389
|
+
if (fs.existsSync(projectRoot)) {
|
|
390
|
+
console.log(` - ${slug}: ${projectRoot}`);
|
|
391
|
+
runInit({ project: slug, cwd: projectRoot });
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
console.log("Global init complete.");
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export {
|
|
398
|
+
upsertInstructionBlock,
|
|
399
|
+
runInit,
|
|
400
|
+
runAutoInit,
|
|
401
|
+
runInitGlobal
|
|
402
|
+
};
|
|
403
|
+
//# sourceMappingURL=chunk-2UKYRERH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/init.ts","../src/cli/templates.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { logger } from '../utils/logger.js';\nimport {\n getAgentsMdTemplate,\n getInstructionsTemplate,\n getGlobalRulesTemplate,\n getMcpConfigCursor,\n getMcpConfigVscode,\n getMcpConfigAntigravity,\n getSkillTemplate,\n} from './templates.js';\nimport { registerProject, resolveProjectRoot, getProjectSlug, getDb } from '../engine/db.js';\nimport { UtilityProfileEngine } from '../engine/personality.js';\nimport { KnowledgeEngine } from '../engine/knowledge.js';\nimport { verifyEventChain } from '../engine/events.js';\n\nexport function upsertInstructionBlock(\n content: string,\n newBlock: string,\n startMarker = '<!-- agent-reasoning-mcp:start -->',\n endMarker = '<!-- agent-reasoning-mcp:end -->'\n): { updatedContent: string; status: 'updated' | 'appended' | 'unchanged' } {\n const startIndex = content.indexOf(startMarker);\n const endIndex = content.indexOf(endMarker);\n\n if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {\n const before = content.substring(0, startIndex);\n const after = content.substring(endIndex + endMarker.length);\n const existingBlock = content.substring(startIndex, endIndex + endMarker.length);\n if (existingBlock.trim() === newBlock.trim()) {\n return { updatedContent: content, status: 'unchanged' };\n }\n return { updatedContent: `${before}${newBlock.trim()}${after}`, status: 'updated' };\n }\n\n const separator = content.endsWith('\\n') ? '\\n' : '\\n\\n';\n return { updatedContent: `${content}${separator}${newBlock.trim()}\\n`, status: 'appended' };\n}\n\nfunction mergeMcpConfig(\n root: string,\n relativePath: string,\n label: string,\n template: Record<string, any>,\n serversKey: string\n): void {\n const filePath = path.join(root, relativePath);\n const dir = path.dirname(filePath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n\n if (fs.existsSync(filePath)) {\n try {\n const raw = fs.readFileSync(filePath, 'utf-8');\n const existing = JSON.parse(raw);\n if (existing[serversKey]?.['agent-reasoning-mcp']) {\n return;\n }\n if (!existing[serversKey]) existing[serversKey] = {};\n existing[serversKey]['agent-reasoning-mcp'] = template[serversKey]['agent-reasoning-mcp'];\n fs.writeFileSync(filePath, JSON.stringify(existing, null, 2) + '\\n', 'utf-8');\n } catch {\n fs.writeFileSync(filePath, JSON.stringify(template, null, 2) + '\\n', 'utf-8');\n }\n } else {\n fs.writeFileSync(filePath, JSON.stringify(template, null, 2) + '\\n', 'utf-8');\n }\n}\n\nexport function runInit(options: { project?: string; cwd?: string } = {}): void {\n const cwd = options.cwd || process.cwd();\n const root = options.project ? resolveProjectRoot(options.project, cwd) : path.resolve(cwd);\n const slug = options.project\n ? getProjectSlug(options.project, cwd)\n : getProjectSlug(undefined, root);\n\n console.log('\\nš§ Initializing agent-reasoning-mcp...\\n');\n\n // 1. Register project in global registry\n registerProject(slug, root);\n console.log(` š Registered project \"${slug}\" in global registry (${root})`);\n\n // 2. Create local storage directory\n const dataDir = path.join(root, '.agent-reasoning-mcp', slug);\n if (!fs.existsSync(dataDir)) {\n fs.mkdirSync(dataDir, { recursive: true, mode: 0o700 });\n }\n console.log(` š¦ Created local storage directory: .agent-reasoning-mcp/${slug}`);\n\n // 3. Update .gitignore\n const gitignorePath = path.join(root, '.gitignore');\n const ignoreEntry = '.agent-reasoning-mcp';\n if (fs.existsSync(gitignorePath)) {\n const content = fs.readFileSync(gitignorePath, 'utf-8');\n if (!content.includes(ignoreEntry)) {\n fs.appendFileSync(gitignorePath, `\\n${ignoreEntry}\\n`, 'utf-8');\n console.log(` š”ļø Updated .gitignore (${ignoreEntry})`);\n }\n }\n\n // 4. Scaffold Agent Instructions\n const instructions = getInstructionsTemplate(slug);\n const targets = [\n '.agents/AGENTS.md',\n 'CLAUDE.md',\n '.windsurfrules',\n '.cursor/rules/agent-reasoning-mcp.mdc',\n '.gemini/instructions.md',\n '.vscode/instructions.md',\n '.github/copilot-instructions.md',\n ];\n\n console.log(' š Scaffolding agent instruction contracts:');\n for (const t of targets) {\n const fullPath = path.join(root, t);\n const dir = path.dirname(fullPath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n\n if (fs.existsSync(fullPath)) {\n const content = fs.readFileSync(fullPath, 'utf-8');\n const { updatedContent, status } = upsertInstructionBlock(content, instructions);\n fs.writeFileSync(fullPath, updatedContent, 'utf-8');\n console.log(` - ${t} (${status})`);\n } else {\n fs.writeFileSync(fullPath, instructions.trim() + '\\n', 'utf-8');\n console.log(` - ${t} (created)`);\n }\n }\n\n // 5. Scaffold Antigravity Skill\n const skillContent = getSkillTemplate(slug);\n const localSkillDir = path.join(root, '.agents/skills/agent-reasoning-mcp');\n if (!fs.existsSync(localSkillDir)) fs.mkdirSync(localSkillDir, { recursive: true });\n fs.writeFileSync(path.join(localSkillDir, 'SKILL.md'), skillContent, 'utf-8');\n\n const homedir = os.homedir();\n const globalSkillDir = path.join(homedir, '.gemini/config/skills/agent-reasoning-mcp');\n try {\n if (!fs.existsSync(globalSkillDir)) fs.mkdirSync(globalSkillDir, { recursive: true });\n fs.writeFileSync(path.join(globalSkillDir, 'SKILL.md'), skillContent, 'utf-8');\n } catch {}\n console.log(' š§ Installed Antigravity agent skill at: .agents/skills/agent-reasoning-mcp');\n\n // 6. Merge IDE MCP Configurations\n mergeMcpConfig(root, '.cursor/mcp.json', 'Cursor', getMcpConfigCursor(slug), 'mcpServers');\n mergeMcpConfig(root, '.vscode/mcp.json', 'VS Code', getMcpConfigVscode(slug), 'servers');\n\n const windsurfDir = path.join(root, '.windsurf');\n if (fs.existsSync(windsurfDir)) {\n mergeMcpConfig(root, '.windsurf/mcp.json', 'Windsurf', getMcpConfigCursor(slug), 'mcpServers');\n }\n\n const claudeDir =\n process.platform === 'darwin'\n ? path.join(homedir, 'Library', 'Application Support', 'Claude')\n : process.platform === 'win32'\n ? path.join(process.env.APPDATA || path.join(homedir, 'AppData', 'Roaming'), 'Claude')\n : path.join(homedir, '.config', 'Claude');\n\n if (fs.existsSync(claudeDir)) {\n mergeMcpConfig(\n claudeDir,\n 'claude_desktop_config.json',\n 'Claude Desktop',\n getMcpConfigCursor(slug),\n 'mcpServers'\n );\n }\n\n const globalMcpConfig = path.join(homedir, '.gemini/config/mcp_config.json');\n try {\n if (fs.existsSync(path.dirname(globalMcpConfig))) {\n mergeMcpConfig(\n homedir,\n '.gemini/config/mcp_config.json',\n 'Antigravity',\n getMcpConfigAntigravity(),\n 'mcpServers'\n );\n }\n\n const geminiConfigJson = path.join(homedir, '.gemini/config/config.json');\n if (fs.existsSync(geminiConfigJson)) {\n try {\n const raw = fs.readFileSync(geminiConfigJson, 'utf-8');\n const data = JSON.parse(raw);\n if (data.userSettings?.globalPermissionGrants?.allow) {\n let updated = false;\n for (const perm of ['command(agent-reasoning-mcp)']) {\n if (!data.userSettings.globalPermissionGrants.allow.includes(perm)) {\n data.userSettings.globalPermissionGrants.allow.push(perm);\n updated = true;\n }\n }\n if (updated) {\n fs.writeFileSync(geminiConfigJson, JSON.stringify(data, null, 2) + '\\n', 'utf-8');\n console.log(\n ' ā
Google Antigravity (config.json) ā granted command(agent-reasoning-mcp)'\n );\n }\n }\n } catch {}\n }\n } catch {}\n console.log(\n ' š Configured IDE MCP Servers (Cursor, VS Code, Windsurf, Claude Desktop, Antigravity)'\n );\n\n // Global Rules\n const globalTargets = [\n { path: path.join(homedir, '.cursorrules'), label: 'Global Cursor Rules (~/.cursorrules)' },\n {\n path: path.join(homedir, '.gemini/GEMINI.md'),\n label: 'Global Gemini Rules (~/.gemini/GEMINI.md)',\n },\n ];\n const globalRulesText = getGlobalRulesTemplate(slug);\n for (const target of globalTargets) {\n if (target.path.includes('.gemini') && !fs.existsSync(path.dirname(target.path))) {\n continue;\n }\n if (fs.existsSync(target.path)) {\n const content = fs.readFileSync(target.path, 'utf-8');\n const { updatedContent, status } = upsertInstructionBlock(content, globalRulesText);\n if (status !== 'unchanged') {\n fs.writeFileSync(target.path, updatedContent, 'utf-8');\n console.log(` ā
${target.label} ā ${status} rules`);\n }\n } else {\n fs.writeFileSync(target.path, globalRulesText, 'utf-8');\n console.log(` ā
${target.label} ā created`);\n }\n }\n\n // 7. Initialize Database and seed defaults\n const db = getDb(slug, root);\n console.log(' š¾ Initialized SQLite database with WAL mode & SHA-256 Merkle audit chain');\n\n // Seed default utility profiles if empty\n const profiles = UtilityProfileEngine.listProfiles(db, slug);\n if (profiles.length <= 1) {\n UtilityProfileEngine.configureProfile(db, {\n project: slug,\n name: 'aggressive',\n description: 'High combat and threat engagement bias',\n weights: {\n aggression: 0.9,\n caution: 0.2,\n greed: 0.5,\n efficiency: 0.8,\n exploration: 0.6,\n cooperation: 0.4,\n },\n });\n UtilityProfileEngine.configureProfile(db, {\n project: slug,\n name: 'cautious',\n description: 'High defense and risk aversion bias',\n weights: {\n aggression: 0.1,\n caution: 0.95,\n greed: 0.3,\n efficiency: 0.7,\n exploration: 0.4,\n cooperation: 0.8,\n },\n });\n console.log(' š± Seeded standard utility scoring profiles (balanced, aggressive, cautious)');\n }\n\n const seededPatterns = KnowledgeEngine.seedDefaultPatterns(db, slug);\n if (seededPatterns > 0) {\n console.log(` š± Seeded ${seededPatterns} tactical gaming & navigation knowledge patterns`);\n }\n\n // 8. Health Audit\n const audit = verifyEventChain(db, slug);\n console.log(\n ` š Audited cryptographic event ledger: ${audit.valid ? 'ā
Unbroken SHA-256 chain' : 'ā ļø Verification anomaly'}`\n );\n\n console.log(`\\n⨠agent-reasoning-mcp initialized successfully for \"${slug}\"!`);\n console.log(' Run \"agent-reasoning-mcp doctor\" to verify runtime health.');\n console.log(' Run \"agent-reasoning-mcp inspect\" to view goals, beliefs, and traces.\\n');\n}\n\nexport async function runAutoInit(root?: string, projectSlug?: string): Promise<void> {\n const originalLog = console.log;\n console.log = (...args) => console.error(...args);\n try {\n runInit({ project: projectSlug, cwd: root });\n } catch (err: any) {\n logger.warn(`Auto-init skipped: ${err.message}`);\n } finally {\n console.log = originalLog;\n }\n}\n\nexport async function runInitGlobal(): Promise<void> {\n const { getRegistry } = await import('../engine/db.js');\n const registry = getRegistry();\n const entries = Object.entries(registry);\n console.log(`Running global init across ${entries.length} registered project(s)...`);\n\n for (const [slug, projectRoot] of entries) {\n if (fs.existsSync(projectRoot)) {\n console.log(` - ${slug}: ${projectRoot}`);\n runInit({ project: slug, cwd: projectRoot });\n }\n }\n console.log('Global init complete.');\n}\n","export function getAgentsMdTemplate(projectSlug = 'default'): string {\n return `<!-- agent-reasoning-mcp:start -->\n# Strategic Agent Reasoning (agent-reasoning-mcp)\n\nThis project uses \\`agent-reasoning-mcp\\` with project slug \"${projectSlug}\" to manage goals, decompose complex tasks, evaluate situational trade-offs, and track decision rationale.\n\n## Mandatory Reasoning Workflow\n1. **Start of planning**: Call \\`set_goal(action: \"create\", title: \"...\")\\` to establish high-level objectives.\n2. **Decomposition**: Call \\`set_goal(action: \"decompose\", parent_id: \"...\", subgoals: [...])\\` to break down into actionable steps.\n3. **Situational Trade-offs**: Call \\`evaluate_situation(action: \"snapshot\", snapshot: {...})\\` before selecting high-stakes actions.\n4. **Utility Configuration**: Tune agent priorities with \\`set_utility_weights(action: \"configure\", weights: {...})\\`.\n5. **Intention Dispatch**: Create execution directives with \\`manage_intentions(action: \"create\", ...)\\` for the runtime engine.\n6. **Reactive Replanning**: If an unexpected blocker occurs, invoke \\`replan(action: \"blocker\", goal_id: \"...\", blocker_description: \"...\")\\`.\n\n## 10 Core MCP Tools\n- \\`set_goal\\`: Manage goal hierarchy and task DAGs.\n- \\`evaluate_situation\\`: Score and rank candidate actions from environment snapshots.\n- \\`replan\\`: Adaptively reconstruct subgoals upon obstacles.\n- \\`assess_risk\\`: Quantitative threat and risk calculation.\n- \\`query_knowledge\\`: Search heuristics and past decision patterns.\n- \\`set_utility_weights\\`: Configure utility weights (aggression, caution, greed, exploration).\n- \\`get_decision_trace\\`: Explainable chain-of-thought rationale playback.\n- \\`manage_beliefs\\`: Structured belief state with exponential confidence decay.\n- \\`manage_intentions\\`: Wire contract directives queue for runtime execution.\n- \\`manage_reasoning_db\\`: Snapshots, diagnostics, and SHA-256 Merkle audit verification.\n<!-- agent-reasoning-mcp:end -->\n`;\n}\n\nexport function getInstructionsTemplate(projectSlug: string): string {\n return getAgentsMdTemplate(projectSlug);\n}\n\nexport function getGlobalRulesTemplate(projectSlug: string): string {\n return `<!-- agent-reasoning-mcp:start -->\n# Strategic Agent Reasoning (agent-reasoning-mcp)\n\nThis project uses agent-reasoning-mcp with project slug \"${projectSlug}\" for BDI decision intelligence.\nALWAYS evaluate situation snapshots against active utility weights before taking high-stakes actions.\n\n## Mandatory Workflow\n1. **Goals**: Call \\`set_goal\\` to track objectives.\n2. **Evaluation**: Call \\`evaluate_situation\\` for candidate action scoring.\n3. **Intentions**: Dispatch execution directives via \\`manage_intentions\\`.\n4. **Replanning**: Call \\`replan\\` when blocked.\n<!-- agent-reasoning-mcp:end -->\n`;\n}\n\nexport function getMcpConfigCursor(projectSlug: string): Record<string, unknown> {\n return {\n mcpServers: {\n 'agent-reasoning-mcp': {\n command: 'agent-reasoning-mcp',\n args: ['run'],\n env: {\n REASONING_PROJECT: projectSlug,\n },\n },\n },\n };\n}\n\nexport function getMcpConfigVscode(projectSlug: string): Record<string, unknown> {\n return {\n servers: {\n 'agent-reasoning-mcp': {\n type: 'stdio',\n command: 'agent-reasoning-mcp',\n args: ['run'],\n env: {\n REASONING_PROJECT: projectSlug,\n },\n },\n },\n };\n}\n\nexport function getMcpConfigAntigravity(): Record<string, unknown> {\n return {\n mcpServers: {\n 'agent-reasoning-mcp': {\n command: 'agent-reasoning-mcp',\n args: ['run'],\n },\n },\n };\n}\n\nexport function getSkillTemplate(projectSlug: string): string {\n return `---\nname: agent-reasoning-mcp\ndescription: Teaches the agent to use the Strategic Agent Reasoning MCP server for BDI goals, utility scoring, risk evaluation, and replanning.\n---\n\n# Strategic Agent Reasoning (agent-reasoning-mcp)\n\nThis skill provides step-by-step guidance and operational patterns for interacting with \\`@putervision/agent-reasoning-mcp\\` with project slug \\`\"${projectSlug}\"\\`.\n\n---\n\n## 1. Role in the PuterVision Pentad\n- **Workflow State** (\\`state-memory-mcp\\`): Persistent task DAGs, decisions, milestones, and blockers.\n- **Perception** (\\`vision-memory-mcp\\`): Visual layout caching, screenshots, and visual specifications.\n- **Spatial World** (\\`world-model-mcp\\`): Persistent 3D/2D coordinates, bounding boxes, and topological relations.\n- **Strategic Reasoning** (\\`agent-reasoning-mcp\\`): BDI goal decomposition, multi-attribute expected utility calculation, belief decay, risk assessment, and replanning.\n- **Tactical Execution** (\\`behavior-mcp\\`): Deterministic ~60Hz browser behavior tree execution and reactive preemption.\n\n---\n\n## 2. Core Operational Sequence\n1. **Initialize Objectives**: Call \\`set_goal\\` with \\`action: \"create\"\\` to define top-level goals and \\`action: \"decompose\"\\` to establish subgoals.\n2. **Configure Utility Profile**: Tune agent priorities using \\`set_utility_weights\\` (aggression, caution, greed, exploration).\n3. **Situational Trade-off Scoring**: Call \\`evaluate_situation\\` with \\`action: \"snapshot\"\\` to rank candidate actions using Pareto utility theory.\n4. **Intention Dispatch**: Translate chosen action into an execution directive via \\`manage_intentions\\`.\n5. **Reactive Replanning**: If an unexpected obstacle or blocker emerges, invoke \\`replan\\`.\n\n---\n\n## 3. Complete 10 Consolidated MCP Tools Reference\n\n| Tool Name | Key Actions | Key Parameters | Description |\n|---|---|---|---|\n| \\`set_goal\\` | \\`create\\`, \\`update\\`, \\`get\\`, \\`list\\`, \\`decompose\\`, \\`archive\\` | \\`title\\`, \\`description\\`, \\`priority\\`, \\`parent_id\\`, \\`subgoals\\` | Hierarchical BDI goal management and task DAG decomposition. |\n| \\`evaluate_situation\\` | \\`snapshot\\`, \\`quick\\` | \\`snapshot\\`, \\`candidates\\`, \\`utility_profile\\` | Multi-attribute utility evaluation ranking candidate actions from environment state. |\n| \\`replan\\` | \\`blocker\\`, \\`recovery\\`, \\`alternative\\` | \\`goal_id\\`, \\`blocker_description\\`, \\`strategy\\` | Adaptive DAG reconstruction and alternative path discovery upon obstacles. |\n| \\`assess_risk\\` | \\`assess\\`, \\`matrix\\` | \\`hazards\\`, \\`tolerance\\`, \\`mitigations\\` | Quantitative threat matrix and probabilistic risk scoring. |\n| \\`query_knowledge\\` | \\`search\\`, \\`lookup\\`, \\`heuristics\\` | \\`query\\`, \\`category\\`, \\`tags\\` | Knowledge retrieval of past decision heuristics and domain heuristics. |\n| \\`set_utility_weights\\` | \\`configure\\`, \\`get\\`, \\`list\\`, \\`profile\\` | \\`name\\`, \\`weights\\` (aggression, caution, greed, exploration) | Utility weight tuning and personality profile management. |\n| \\`get_decision_trace\\` | \\`get\\`, \\`list\\`, \\`explain\\` | \\`trace_id\\`, \\`limit\\` | Explainable chain-of-thought rationale playback and auditing. |\n| \\`manage_beliefs\\` | \\`set\\`, \\`get\\`, \\`decay\\`, \\`list\\` | \\`key\\`, \\`value\\`, \\`confidence\\`, \\`decay_rate\\` | Structured belief state with temporal exponential confidence decay. |\n| \\`manage_intentions\\` | \\`create\\`, \\`get\\`, \\`list\\`, \\`dispatch\\`, \\`cancel\\` | \\`goal_id\\`, \\`behavior_name\\`, \\`parameters\\` | Execution directives queue connecting strategic plans to runtime engines. |\n| \\`manage_reasoning_db\\` | \\`stats\\`, \\`audit\\`, \\`snapshot\\`, \\`restore\\`, \\`prune\\` | \\`action\\`, \\`name\\`, \\`description\\` | Database diagnostics, snapshots, and SHA-256 Merkle audit verification. |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