You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: promote memory to cache-memory tool and add first-class azure-devops tool (#167)
* refactor: rename src/tools to src/safeoutputs, create src/tools for first-class tools
Rename the existing tools directory to safeoutputs to better reflect its
purpose (safe-output MCP tool implementations that serialize to NDJSON
in Stage 1 and execute in Stage 2).
Create a new src/tools directory for first-class tool implementations
that the compiler auto-configures (cache-memory, azure-devops).
Move memory.rs from safeoutputs to tools/cache_memory.rs since memory
is a first-class tool, not a safe-output.
Add CacheMemoryToolConfig and AzureDevOpsToolConfig types to
compile/types.rs with support for both boolean and object front-matter
formats. Extend ToolsConfig to include cache-memory and azure-devops
fields.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: migrate memory from safe-outputs to tools.cache-memory
Move memory configuration from safe-outputs: memory: to tools:
cache-memory: in the front matter. This aligns with gh-aw's cache-memory
tool pattern where memory is a first-class tool, not a safe-output.
Key changes:
- Update has_memory detection in standalone.rs and onees.rs to read
from tools.cache-memory instead of safe-outputs.memory
- Update main.rs Stage 2 executor to resolve MemoryConfig from
tools.cache-memory
- Remove 'memory' from NON_MCP_SAFE_OUTPUT_KEYS and ALL_KNOWN_SAFE_OUTPUTS
- Update integration tests to use tools: cache-memory: format
- Update enabled-tools-args tests (memory no longer affects filtering)
- No backward compatibility for safe-outputs.memory
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add first-class azure-devops tool support
Add tools.azure-devops as a first-class compiler tool that auto-configures
the Azure DevOps MCP container in the MCPG config. This replaces the need
for manual mcp-servers configuration with boilerplate container/entrypoint
settings.
When tools.azure-devops is enabled, the compiler:
- Auto-generates a containerized stdio MCP entry (node:20-slim + npx
@azure-devops/mcp) in the MCPG configuration
- Auto-maps ADO token (AZURE_DEVOPS_EXT_PAT) passthrough when
permissions.read is configured
- Adds ADO-specific hosts to the network allowlist
- Supports toolsets (repos, wit, core etc.) as -d flags
- Supports explicit tool allow-list for MCPG filtering
- Auto-infers org from pipeline runtime variables with optional override
- Warns on conflict with manual mcp-servers.azure-devops entry
Front-matter example:
tools:
azure-devops:
toolsets: [repos, wit]
allowed: [wit_get_work_item]
org: myorg # optional, auto-inferred
Also adds ADO_ORG_NAME runtime extraction to the base template for
org auto-inference from $(System.TeamFoundationCollectionUri).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: update AGENTS.md and examples for tools refactor
- Update architecture tree to show src/safeoutputs/ and src/tools/
- Add cache-memory and azure-devops tool documentation under Tools Configuration
- Update memory safe-output section to point to new tools.cache-memory location
- Update front-matter example to show new tool entries
- Update 'Adding New Features' section with safeoutputs vs tools distinction
- Update azure-devops-mcp.md example to use tools.azure-devops instead of
manual mcp-servers configuration
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: infer ADO org from git remote at compile time, fail on missing org
Replace the runtime $(ADO_ORG_NAME) pipeline variable approach with
compile-time inference using the existing parse_ado_remote() function.
The compiler now extracts the org from the git remote URL when compiling.
Key changes:
- generate_mcpg_config() now returns Result and accepts inferred_org
- Compilation fails with a clear error if tools.azure-devops is enabled
but no org can be determined (no explicit override + no ADO git remote)
- Remove $(ADO_ORG_NAME) runtime substitution from base.yml template
- Remove unused project field from AzureDevOpsOptions (not supported by
@azure-devops/mcp and was silently discarded)
- Make get_git_remote_url public for use by the compiler
- Add test_ado_tool_no_org_fails and test_ado_tool_explicit_org_overrides_inferred
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: remove project field — not supported by @azure-devops/mcp
The ADO MCP only accepts org as a positional arg. The project field was
added speculatively but is not a supported option. Keep only org (with
compile-time git remote inference and explicit override).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: wire MCPG_IMAGE constant into template, fix stale memory comment
- Replace hardcoded ghcr.io/github/gh-aw-mcpg in base.yml with
{{ mcpg_image }} marker, replaced by MCPG_IMAGE constant in
standalone.rs — single source of truth for the image name
- Fix stale comment in mcp.rs that still referenced 'memory' in
NON_MCP_SAFE_OUTPUT_KEYS (now empty)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: validate ADO org/toolset names, add memory deprecation hint
- Validate org name (alphanumerics + hyphens only) at compile time to
catch invalid values early instead of cryptic MCPG runtime failures
- Validate toolset names with the same rule
- Add specific deprecation hint when safe-outputs: memory: is detected,
directing users to tools: cache-memory:
- Add tests for invalid org and invalid toolset rejection
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Persistent memory storage across agent runs. The agent reads/writes files to a memory directory that persists between pipeline executions via pipeline artifacts.
420
+
421
+
```yaml
422
+
# Simple enablement
423
+
tools:
424
+
cache-memory: true
425
+
426
+
# With options
427
+
tools:
428
+
cache-memory:
429
+
allowed-extensions: [.md, .json, .txt]
430
+
```
431
+
432
+
When enabled, the compiler auto-generates pipeline steps to:
433
+
- Download previous memory from the last successful run's artifact
434
+
- Restore files to `/tmp/awf-tools/staging/agent_memory/`
435
+
- Append a memory prompt to the agent instructions
436
+
- Auto-inject a `clearMemory` pipeline parameter (allows clearing memory from the ADO UI)
437
+
438
+
During Stage 2 execution, memory files are validated (path safety, extension filtering, `##vso[` injection detection, 5 MB size limit) and published as a pipeline artifact.
439
+
440
+
#### Azure DevOps MCP (`azure-devops:`)
441
+
442
+
First-class Azure DevOps MCP integration. Auto-configures the ADO MCP container, token mapping, MCPG entry, and network allowlist.
443
+
444
+
```yaml
445
+
# Simple enablement (auto-infers org from git remote)
446
+
tools:
447
+
azure-devops: true
448
+
449
+
# With scoping options
450
+
tools:
451
+
azure-devops:
452
+
toolsets: [repos, wit, core] # ADO API toolset groups
org: myorg # Optional override (inferred from git remote)
455
+
```
456
+
457
+
When enabled, the compiler:
458
+
- Generates a containerized stdio MCP entry (`node:20-slim` + `npx @azure-devops/mcp`) in the MCPG config
459
+
- Auto-maps `AZURE_DEVOPS_EXT_PAT` token passthrough when `permissions.read` is configured
460
+
- Adds ADO-specific hosts to the network allowlist
461
+
- Auto-infers org from the git remote URL at compile time (overridable via `org:` field)
462
+
- Fails compilation if org cannot be determined (no explicit override and no ADO git remote)
463
+
395
464
### Target Platforms
396
465
397
466
The `target` field in the front matter determines the output format and execution environment for the compiled pipeline.
@@ -1066,35 +1135,8 @@ Reports that a tool or capability needed to complete the task is not available.
1066
1135
-`tool_name` - Name of the tool that was expected but not found
1067
1136
-`context` - Optional context about why the tool was needed
1068
1137
1069
-
#### memory
1070
-
Provides persistent memory across agent runs. When enabled, the agent can read and write files to a memory directory that persists between pipeline executions.
1071
-
1072
-
**Configuration options (front matter):**
1073
-
```yaml
1074
-
safe-outputs:
1075
-
memory:
1076
-
allowed-extensions: # Optional: restrict file types (defaults to all)
1077
-
- .md
1078
-
- .json
1079
-
- .txt
1080
-
```
1081
-
1082
-
**How it works:**
1083
-
1. During Stage 1 (agent execution), the agent can write files to `/tmp/awf-tools/staging/agent_memory/`
1084
-
2. A prompt is automatically appended to inform the agent about its memory location
1085
-
3. During Stage 2 execution, memory files are validated and sanitized:
1086
-
- Path traversal attempts are blocked
1087
-
- Files are checked for `##vso[` command injection
1088
-
- Total size is limited to 5 MB
1089
-
- File extensions can be restricted via configuration
1090
-
4. Sanitized memory files are published as a pipeline artifact
1091
-
5. On the next run, the previous memory is downloaded and restored to the staging directory
1092
-
1093
-
**Security validations:**
1094
-
- Maximum total memory size: 5 MB
1095
-
- Path validation: no `..`, `.git`, absolute paths, or null bytes
1096
-
- Content validation: text files are scanned for `##vso[` commands
1097
-
- Extension filtering: can restrict to specific file types
1138
+
#### cache-memory (moved to `tools:`)
1139
+
Memory is now configured as a first-class tool under `tools: cache-memory:` instead of `safe-outputs: memory:`. See the [Cache Memory](#cache-memory-cache-memory) section under Tools Configuration for details.
1098
1140
1099
1141
#### create-wiki-page
1100
1142
Creates a new Azure DevOps wiki page. The page must **not** already exist; the tool enforces an atomic create-only operation (via `If-Match: ""`). Attempting to create a page that already exists results in an explicit failure.
@@ -1154,7 +1196,9 @@ When extending the compiler:
1154
1196
2. **New compile targets**: Implement the `Compiler` trait in a new file under `src/compile/`
1155
1197
3. **New front matter fields**: Add fields to `FrontMatter` in `src/compile/types.rs`
1156
1198
4. **New template markers**: Handle replacements in the target-specific compiler (e.g., `standalone.rs` or `onees.rs`)
1157
-
5. **Validation**: Add compile-time validation for safe outputs and permissions
1199
+
5. **New safe-output tools**: Add to `src/safeoutputs/` — implement `ToolResult`, `Executor`, register in `mod.rs`, `mcp.rs`, `execute.rs`
1200
+
6. **New first-class tools**: Add to `src/tools/` — extend `ToolsConfig` in `types.rs`, wire in compilers
1201
+
7. **Validation**: Add compile-time validation for safe outputs and permissions
0 commit comments