@trygentic/agentloop 0.13.2-alpha.11 → 0.15.0-alpha.11

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
@@ -484,7 +484,6 @@ AgentLoop uses YAML configuration files with a layered priority system.
484
484
  ```yaml
485
485
  orchestrator:
486
486
  max_parallel_agents: 1 # Number of agents that can run in parallel
487
- use_worktrees: false # Enable git worktrees for parallel development
488
487
  worktrees_dir: ".worktrees" # Directory for worktrees (relative to project)
489
488
  cleanup_worktrees_on_complete: false # Auto-cleanup worktrees after completion
490
489
  ```
@@ -492,7 +491,6 @@ orchestrator:
492
491
  | Option | Default | Env Variable | Description |
493
492
  |--------|---------|--------------|-------------|
494
493
  | `max_parallel_agents` | `1` | `AGENTLOOP_MAX_PARALLEL_AGENTS` | Maximum parallel agents |
495
- | `use_worktrees` | `false` | `AGENTLOOP_USE_WORKTREES` | Enable git worktrees |
496
494
  | `worktrees_dir` | `.worktrees` | `AGENTLOOP_WORKTREES_DIR` | Worktrees directory |
497
495
  | `cleanup_worktrees_on_complete` | `false` | `AGENTLOOP_CLEANUP_WORKTREES` | Auto-cleanup worktrees |
498
496
 
@@ -576,7 +574,6 @@ github:
576
574
 
577
575
  orchestrator:
578
576
  max_parallel_agents: 4
579
- use_worktrees: true
580
577
  ```
581
578
 
582
579
  **Project-level overrides** (`./.agentloop/config.yaml`):
@@ -636,20 +633,6 @@ agentloop config
636
633
  - npm or yarn
637
634
  - Podman (optional, for container sandboxing)
638
635
 
639
- ## Architecture
640
-
641
- AgentLoop uses [OpenCode](https://github.com/anthropics/opencode) as a git submodule for:
642
-
643
- - **Tool System** (`@opencode/tool/`): Built-in tools (bash, read, write, edit, grep, glob, etc.)
644
- - **LLM Abstraction** (`@opencode/session/llm`): Vercel AI SDK integration with streaming support
645
- - **Provider Management** (`@opencode/provider/`): 18+ bundled AI SDK providers
646
-
647
- ### Core Technologies
648
-
649
- - **OCLIF**: CLI framework for command-line interface
650
- - **OpenTUI**: Terminal UI framework (React-like components)
651
- - **Better SQLite3**: Local database for state management
652
- - **MCP (Model Context Protocol)**: Extensible tool system
653
636
 
654
637
  ### Supported Providers
655
638
 
@@ -658,58 +641,6 @@ All providers supported by OpenCode (via Vercel AI SDK):
658
641
  - **OpenAI** - Codex models
659
642
  - **OpenCode Zen** - Free tier for getting started
660
643
 
661
-
662
- ## MCP Servers
663
-
664
- AgentLoop integrates with various Model Context Protocol (MCP) servers to enhance agent capabilities:
665
-
666
- ### Configured MCP Servers
667
-
668
- | Server | Description | Tools |
669
- |--------|-------------|-------|
670
- | **serena** | Code editing and codebase traversal | File operations, symbol manipulation, code generation |
671
- | **code-graph-rag** | Semantic code analysis with RAG | 24 tools for code search, similarity detection, impact analysis |
672
- | **playwright** | Browser automation and testing | Web scraping, UI testing, interaction automation |
673
- | **supabase** | Database operations | SQL execution, migrations, schema management |
674
- | **mcp-atlassian** | Jira integration | Issue tracking, project management |
675
- | **agentloop-debug** | Internal debugging tools | Task management, agent coordination |
676
-
677
- ### Code Graph RAG MCP
678
-
679
- The **code-graph-rag-mcp** server provides advanced semantic code analysis:
680
-
681
- - **Semantic Search**: Find code by meaning, not just keywords
682
- - **Code Similarity**: Detect duplicate code and similar patterns
683
- - **Impact Analysis**: Assess the impact of potential changes
684
- - **Performance**: 5.5x faster than traditional file-based search
685
- - **Languages**: Supports TypeScript, JavaScript, Python, Java, Go, Rust, C++, C#, Ruby, PHP
686
-
687
- **Requirements**: Node.js 18+, 2GB RAM minimum (8GB recommended)
688
-
689
- For detailed information, see [docs/mcp/CODE_GRAPH_RAG_MCP.md](./docs/mcp/CODE_GRAPH_RAG_MCP.md)
690
-
691
- ### Configuring MCP Servers
692
-
693
- MCP servers are configured in `.mcp.json`:
694
-
695
- ```json
696
- {
697
- "mcpServers": {
698
- "code-graph-rag": {
699
- "command": "npx",
700
- "args": ["-y", "@er77/code-graph-rag-mcp", "/work"],
701
- "env": {
702
- "MCP_SEMANTIC_WARMUP_LIMIT": "1000"
703
- }
704
- }
705
- }
706
- }
707
- ```
708
-
709
- For more MCP integration examples, see [docs/mcp/GITHUB_MCP_INTEGRATION.md](./docs/mcp/GITHUB_MCP_INTEGRATION.md)
710
-
711
-
712
-
713
644
  ## Templates
714
645
 
715
646
  Built-in agent templates are distributed as part of the npm package in the `.claude/agents/` directory. When you install AgentLoop, these templates are automatically available and loaded by the agent system.
package/bin/agentloop CHANGED
@@ -46,15 +46,23 @@ if [ "$PLATFORM" = "linux" ]; then
46
46
  fi
47
47
 
48
48
  PACKAGE_NAME="@trygentic/agentloop-${PLATFORM}-${ARCH}${SUFFIX}"
49
- NODE_MODULES="$DIR/../node_modules"
50
- PLATFORM_BIN="$NODE_MODULES/$PACKAGE_NAME/bin/agentloop"
51
49
 
52
- if [ -x "$PLATFORM_BIN" ]; then
53
- exec "$PLATFORM_BIN" "$@"
54
- fi
50
+ # Try multiple node_modules locations (npm may hoist dependencies)
51
+ # 1. Nested: node_modules/@trygentic/agentloop/node_modules/@trygentic/agentloop-darwin-arm64
52
+ # 2. Hoisted: node_modules/@trygentic/agentloop-darwin-arm64
53
+ NESTED_NODE_MODULES="$DIR/../node_modules"
54
+ HOISTED_NODE_MODULES="$DIR/../../.."
55
+
56
+ for NODE_MODULES in "$NESTED_NODE_MODULES" "$HOISTED_NODE_MODULES"; do
57
+ PLATFORM_BIN="$NODE_MODULES/$PACKAGE_NAME/bin/agentloop"
58
+ if [ -x "$PLATFORM_BIN" ]; then
59
+ exec "$PLATFORM_BIN" "$@"
60
+ fi
61
+ done
55
62
 
56
63
  echo "Error: Could not find agentloop executable" >&2
57
64
  echo "Tried:" >&2
58
65
  echo " - $DIR/agentloop-cli (local development)" >&2
59
- echo " - $PLATFORM_BIN (npm package)" >&2
66
+ echo " - $NESTED_NODE_MODULES/$PACKAGE_NAME/bin/agentloop (nested)" >&2
67
+ echo " - $HOISTED_NODE_MODULES/$PACKAGE_NAME/bin/agentloop (hoisted)" >&2
60
68
  exit 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trygentic/agentloop",
3
- "version": "0.13.2-alpha.11",
3
+ "version": "0.15.0-alpha.11",
4
4
  "description": "AI-powered autonomous coding agent",
5
5
  "bin": {
6
6
  "agentloop": "./bin/agentloop"
@@ -9,8 +9,8 @@
9
9
  "postinstall": "node ./scripts/postinstall.mjs"
10
10
  },
11
11
  "optionalDependencies": {
12
- "@trygentic/agentloop-darwin-arm64": "0.13.2-alpha.11",
13
- "@trygentic/agentloop-linux-x64": "0.13.2-alpha.11"
12
+ "@trygentic/agentloop-darwin-arm64": "0.15.0-alpha.11",
13
+ "@trygentic/agentloop-linux-x64": "0.15.0-alpha.11"
14
14
  },
15
15
  "engines": {
16
16
  "node": ">=18.0.0"
@@ -3,8 +3,11 @@
3
3
  /**
4
4
  * AgentLoop postinstall script
5
5
  *
6
- * Creates symlinks from the main package's bin to the platform executables
7
- * for faster execution (avoids the Node.js shim overhead).
6
+ * 1. Creates symlinks from the main package's bin to the platform executables
7
+ * for faster execution (avoids the Node.js shim overhead).
8
+ *
9
+ * 2. Sets up plugin agents in ~/.agentloop/agents/ with folder structure.
10
+ * Plugin agents are non-core agents that can be customized by users.
8
11
  *
9
12
  * If symlink creation fails (e.g., on Windows), the shim will handle
10
13
  * executable discovery at runtime.
@@ -54,6 +57,22 @@ for (const binary of binaries) {
54
57
  const sourcePath = path.join(nodeModules, packageName, "bin", executableName);
55
58
  const targetPath = path.join(binDir, executableName);
56
59
 
60
+ // Check if local binary already exists (not a symlink)
61
+ // This happens when installing from a tarball that includes local binaries
62
+ // In this case, we should NOT replace them with symlinks to npm packages
63
+ if (fs.existsSync(targetPath)) {
64
+ try {
65
+ const stats = fs.lstatSync(targetPath);
66
+ if (!stats.isSymbolicLink()) {
67
+ // Target is a real file, not a symlink - preserve it
68
+ console.log(`agentloop: keeping local ${binary} binary`);
69
+ continue;
70
+ }
71
+ } catch {
72
+ // If we can't stat, proceed with replacement
73
+ }
74
+ }
75
+
57
76
  if (fs.existsSync(sourcePath)) {
58
77
  try {
59
78
  // Remove existing file/symlink
@@ -80,3 +99,139 @@ if (linked > 0) {
80
99
  console.log(`agentloop: platform executables not found (${packageName})`);
81
100
  console.log("agentloop: will use runtime executable resolution");
82
101
  }
102
+
103
+ // =============================================================================
104
+ // Global Agents Setup
105
+ // =============================================================================
106
+ // All agents (core and plugin) are copied to ~/.agentloop/agents/
107
+ // in folder-based structure: agents/<name>/<name>.md (and .bt.json if exists)
108
+ // Users can customize any agent by editing the files in their home directory.
109
+ //
110
+ // Core agents: orchestrator, engineer, product-manager, qa-tester
111
+ // Plugin agents: code-review, container,
112
+ // dag-planner, maestro-qa, merge-resolver, project-detection, questionnaire
113
+
114
+ const globalAgentsDir = path.join(os.homedir(), ".agentloop", "agents");
115
+ const templatesDir = path.resolve(__dirname, "..", "templates", "agents");
116
+ const behaviorTreesDir = path.resolve(__dirname, "..", "behavior-trees", "agents");
117
+
118
+ /**
119
+ * Setup all agents in ~/.agentloop/agents/
120
+ *
121
+ * Discovers agents from:
122
+ * 1. Folder-based structure: templates/agents/<name>/<name>.md (core agents)
123
+ * 2. Flat files: templates/agents/<name>.md (plugin agents)
124
+ * 3. Behavior trees: behavior-trees/agents/<name>.bt.json (standalone BTs)
125
+ */
126
+ function setupGlobalAgents() {
127
+ // Create global agents directory if it doesn't exist
128
+ if (!fs.existsSync(globalAgentsDir)) {
129
+ try {
130
+ fs.mkdirSync(globalAgentsDir, { recursive: true });
131
+ } catch (err) {
132
+ console.log(`agentloop: could not create ${globalAgentsDir}: ${err.message}`);
133
+ return 0;
134
+ }
135
+ }
136
+
137
+ // Discover all agents from templates directory
138
+ const agentsToInstall = new Map(); // agentName -> { mdSource, btSource }
139
+
140
+ if (fs.existsSync(templatesDir)) {
141
+ const entries = fs.readdirSync(templatesDir, { withFileTypes: true });
142
+
143
+ for (const entry of entries) {
144
+ // Skip internal agents directory
145
+ if (entry.name === "internal") continue;
146
+
147
+ if (entry.isDirectory()) {
148
+ // Folder-based agent: templates/agents/<name>/<name>.md
149
+ const agentName = entry.name;
150
+ const mdPath = path.join(templatesDir, agentName, `${agentName}.md`);
151
+ const btPath = path.join(templatesDir, agentName, `${agentName}.bt.json`);
152
+
153
+ agentsToInstall.set(agentName, {
154
+ mdSource: fs.existsSync(mdPath) ? mdPath : null,
155
+ btSource: fs.existsSync(btPath) ? btPath : null,
156
+ });
157
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
158
+ // Flat file agent: templates/agents/<name>.md
159
+ const agentName = entry.name.replace(".md", "");
160
+ if (!agentsToInstall.has(agentName)) {
161
+ agentsToInstall.set(agentName, {
162
+ mdSource: path.join(templatesDir, entry.name),
163
+ btSource: null,
164
+ });
165
+ }
166
+ }
167
+ }
168
+ }
169
+
170
+ // Also check for standalone behavior trees
171
+ if (fs.existsSync(behaviorTreesDir)) {
172
+ const btFiles = fs.readdirSync(behaviorTreesDir).filter(f => f.endsWith(".bt.json"));
173
+ for (const btFile of btFiles) {
174
+ const agentName = btFile.replace(".bt.json", "");
175
+ const btPath = path.join(behaviorTreesDir, btFile);
176
+
177
+ if (agentsToInstall.has(agentName)) {
178
+ // Add BT to existing agent if it doesn't already have one
179
+ const existing = agentsToInstall.get(agentName);
180
+ if (!existing.btSource) {
181
+ existing.btSource = btPath;
182
+ }
183
+ } else {
184
+ // Standalone BT (no markdown)
185
+ agentsToInstall.set(agentName, {
186
+ mdSource: null,
187
+ btSource: btPath,
188
+ });
189
+ }
190
+ }
191
+ }
192
+
193
+ let installed = 0;
194
+
195
+ for (const [agentName, sources] of agentsToInstall) {
196
+ const agentDir = path.join(globalAgentsDir, agentName);
197
+ const mdTarget = path.join(agentDir, `${agentName}.md`);
198
+ const btTarget = path.join(agentDir, `${agentName}.bt.json`);
199
+
200
+ // Skip if agent directory already exists (user may have customized it)
201
+ if (fs.existsSync(agentDir)) {
202
+ continue;
203
+ }
204
+
205
+ // Skip if no source files
206
+ if (!sources.mdSource && !sources.btSource) {
207
+ continue;
208
+ }
209
+
210
+ try {
211
+ // Create agent directory
212
+ fs.mkdirSync(agentDir, { recursive: true });
213
+
214
+ // Copy markdown file if exists
215
+ if (sources.mdSource) {
216
+ fs.copyFileSync(sources.mdSource, mdTarget);
217
+ }
218
+
219
+ // Copy behavior tree if exists
220
+ if (sources.btSource) {
221
+ fs.copyFileSync(sources.btSource, btTarget);
222
+ }
223
+
224
+ installed++;
225
+ } catch (err) {
226
+ console.log(`agentloop: failed to install agent ${agentName}: ${err.message}`);
227
+ }
228
+ }
229
+
230
+ return installed;
231
+ }
232
+
233
+ // Run global agent setup
234
+ const agentCount = setupGlobalAgents();
235
+ if (agentCount > 0) {
236
+ console.log(`agentloop: installed ${agentCount} agent(s) to ${globalAgentsDir}`);
237
+ }