Commands and Capabilities
Scope shell commands and secrets to a session.
A command in Fabric Harness is a shell-level capability you explicitly grant to a session — not a generic "run anything" door. Use defineCommand from @fabric-harness/node to declare one.
Declaring commands
import { defineCommand } from '@fabric-harness/node';
const npm = defineCommand('npm');
const git = defineCommand('git');
const gh = defineCommand('gh', {
env: {
GH_TOKEN: process.env.GH_TOKEN,
},
});A defineCommand declaration captures:
- the binary name,
- environment variables to inject,
- working directory defaults,
- timeouts and stdin handling.
Granting commands per call
await session.prompt('Fix the failing tests', {
commands: [npm, git, gh],
});The model can only run shell commands whose binary matches one of the declared commands. Anything else fails with a capability error.
Secrets
Use secret() and resolveSecret() to keep credentials out of model context:
import { secret, resolveSecret } from '@fabric-harness/sdk';
const token = secret({ envVar: 'GITHUB_TOKEN' });
const value = await resolveSecret(token);secret() is intentionally a token, not the value: it can be passed around without leaking its content into logs, traces, or the LLM context.
Future capability policy
The full policy is roadmap. Designed shape:
await session.prompt('Fix the tests', {
capabilities: {
filesystem: {
read: ['/workspace/**'],
write: ['/workspace/src/**', '/workspace/tests/**'],
},
commands: ['npm test', 'git diff', 'git status'],
network: {
mode: 'allowlist',
hosts: ['api.github.com'],
},
approvals: {
requiredFor: ['git push', 'npm publish', 'terraform apply'],
},
},
});For the MVP, scoped commands + tool capability checks cover most use cases. See Policies and approvals.