feat(runtime): register AGENTS commands as policy-gated runtime actions#3
Merged
feat(runtime): register AGENTS commands as policy-gated runtime actions#3
Conversation
Add AGENTS command registration, deterministic duplicate handling, policy-gated execution/approval flow, structured observability payloads, tests, docs, and archive synced OpenSpec change.
There was a problem hiding this comment.
Pull request overview
This PR wires AGENTS.md command entries into the runtime tool surface so they can be invoked as agents:<name> (optionally also as an unprefixed alias), and routes their execution through policy/approval with structured observability payloads.
Changes:
- Load
AGENTS.mdat runtime, detect duplicate command names with deterministic warnings, and register commands as runtime tools. - Add policy-gated execution for
exec-commandand AGENTS commands, returning structuredpolicyOutcome/executionSummarypayloads. - Extend interactive chat UX and observability (traces + transcripts) to record structured tool execution metadata.
Reviewed changes
Copilot reviewed 13 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/tool-registry.test.ts | Adds coverage for AGENTS tool registration, not-found behavior, and policy outcomes. |
| tests/agents-loader.test.ts | Extends loader tests to assert warnings and deterministic duplicate handling. |
| src/tools/registry.ts | Registers AGENTS commands as tools/aliases; adds policy evaluation + approval gate to command execution. |
| src/tools/exec-command.ts | Adds side-effect classification helpers; propagates toolName into results. |
| src/observability/transcripts.ts | Adds optional structured payload to transcript entries. |
| src/config/agents-loader.ts | Adds warnings to config and emits deterministic duplicate-command warnings. |
| src/cli/runtime.ts | Loads AGENTS config and passes it into ToolRegistry with warning logging. |
| src/cli/commands/chat.tsx | Plumbs transcripts into the chat UI. |
| src/cli/app.tsx | Updates interactive execution flow to use policy outcomes and writes structured trace/transcript payloads. |
| openspec/specs/agents-runtime-actions/spec.md | Adds a spec for AGENTS runtime actions behavior. |
| openspec/changes/archive/** | Archives the spec-driven change artifacts (tasks/spec/proposal/design). |
| openspec/changes/agents-md-runtime-actions/tasks.md | Removes the unarchived tasks file. |
| docs/agents-runtime-actions.md | Documents registration, resolution rules, and policy/observability behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Mar 3, 2026
- infer and conservatively rank side effects for exec-command policy checks - pass invocation cwd into policy evaluation for exec and AGENTS commands - make write-path test hermetic and complete runtime actions spec purpose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AGENTS.mdcommands as runtime-invokable tools (agents:<name>, plus unprefixed alias when non-conflicting).actionName,resolvedCommand,policyOutcome,executionSummary).agents-md-runtime-actionsinto main specs.Behavior Details
Tests and Verification
pnpm testpnpm typecheckpnpm lintDocs
docs/agents-runtime-actions.md.openspec/specs/agents-runtime-actions/spec.md.🥞 DubStack