API surface
AGS exposes three complementary surfaces: package exports (TypeScript), MCP tools (agent-callable), and CLI scripts (local / CI).
Package imports
import {
/* root plugins + TOC */
} from '@tmrxjd/agent-governance-system';
import { validateAgentCommitMessage } from '@tmrxjd/agent-governance-system/commit-msg';
import { /* CAP helpers */ } from '@tmrxjd/agent-governance-system/commit-cap';
import { /* confidence */ } from '@tmrxjd/agent-governance-system/confidence';
import { /* gates */ } from '@tmrxjd/agent-governance-system/gates';
import { /* product keys */ } from '@tmrxjd/agent-governance-system/product-licensing';High-value entry points:
| Import | Use for |
|---|---|
@tmrxjd/agent-governance-system/commit-msg | validateAgentCommitMessage in git hooks and CI |
…/commit-cap | Read / set CAP state (off | on | close-only) |
…/confidence | Score whether a change set is safe to checkpoint |
…/gates | Run named gates (gate.array, gate.canonical, …) |
…/product-licensing | Verify license keys and tier capabilities |
…/plugin | Host plugin API — register engines into an MCP toolkit |
Validate a commit message
import { validateAgentCommitMessage } from '@tmrxjd/agent-governance-system/commit-msg';
const result = validateAgentCommitMessage(message);
if (!result.ok) {
console.error(result.errors);
process.exit(1);
}Required trailers include Status, Commit-Scope, Not-done, Next, Evidence, Graph-ids, User-approved, and Enforcement. Forbidden phrases include claims like “shipped” or “feature is done”
unless you are on an approved close path. Full scope list: Staging scopes.
MCP tools (agent loop)
enforcement_begin
staging_enforce
confidence_enforce
schema_enforce / pointer_enforce / semantic_enforce
performance_validate
testing_validate
sentinel_status
commit_checkpoint| Tool | Purpose |
|---|---|
| commit_authorize | Get/set CAP |
| enforcement_begin | Open an enforcement session for this turn |
| staging_classify / staging_enforce | Propose and lock a Commit-Scope |
| confidence_enforce | Block low-confidence critical commits |
| schema_enforce · pointer_enforce · semantic_enforce | Domain integrity |
| array_* · canon_* | List + SoT enforcement |
| testing_plan / testing_validate | Which tests must run for touched paths |
| sentinel_status | Aggregate halt / remediate signals |
| commit_checkpoint / commit_close | Write the CAP-gated commit |
// MCP tool: commit_authorize
{ "state": "on", "note": "feature work session" }
// Read current CAP
{}// MCP tool: commit_checkpoint
{
"message": "status/checkpoint(staging): classify auth diff\n\n…trailers…",
"files": ["src/auth/session.ts", "src/auth/session.test.ts"],
"dryRun": false
}// MCP tool: testing_plan
{
"paths": ["packages/app/src/auth/session.ts"]
}
// → suiteIds + vitestPaths the agent must run before commit
// MCP tool: testing_validate
{}CLI
Common local / CI commands (package scripts; names may be aliased in your monorepo):
pnpm testing:plan -- --paths packages/app/src/auth/session.ts
pnpm testing:validate
pnpm semantic:get
pnpm sentinel:status
pnpm performance:get Next: Tutorials walks through enabling CAP and landing the first governed checkpoint.