feat: add governance system for prompt evolution

Implement a comprehensive governance system to manage agent prompt changes safely.

Key features:
- **Proposal Workflow:** Prompt changes are now "proposals" stored in `src/proposals/` with metadata and diffs.
- **Governance Agent:** A new `governance-agent` reviews and applies proposals using `scripts/governance/process-proposals.mjs`.
- **Validation:** Strict validation ensures changes are limited to allowed directories (`src/prompts/daily|weekly`) and preserve required headers.
- **Lock Enhancements:** Lock events now include `promptHash`, `promptPath`, and `gitCommit` for full auditability.
- **Rollback:** New `torch-lock rollback` command restores prompts from local history (`.torch/prompt-history/`) or git.
- **CLI:** Added `proposal` (create, list, show, apply, reject) and `rollback` commands.

This establishes a "Stage -> Evaluate -> Apply" gate for prompt evolution, preventing silent drift and ensuring constitutional stability.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-18 21:09:39 +00:00
1 parent 470093d9ad
commit 64b6f43df1
8 files changed
+606

No files matched your search

+31
View File
@@ -34,12 +34,23 @@ export function parseArgs(argv) {
windowMinutes: null,
platform: null,
model: null,
subcommand: null,
target: null,
content: null,
reason: null,
strategy: null,
status: null,
};
let i = 0;
if (argv.length > 0 && !argv[0].startsWith('-')) {
args.command = argv[0];
i = 1;
// Support subcommands for 'proposal'
if (args.command === 'proposal' && argv.length > 1 && !argv[1].startsWith('-')) {
args.subcommand = argv[1];
i = 2;
}
}
for (; i < argv.length; i++) {
@@ -130,6 +141,26 @@ export function parseArgs(argv) {
args.model = argv[++i];
} else if (arg.startsWith('--model=')) {
args.model = arg.split('=')[1];
} else if (arg === '--target') {
args.target = argv[++i];
} else if (arg.startsWith('--target=')) {
args.target = arg.split('=')[1];
} else if (arg === '--content') {
args.content = argv[++i];
} else if (arg.startsWith('--content=')) {
args.content = arg.split('=')[1];
} else if (arg === '--reason') {
args.reason = argv[++i];
} else if (arg.startsWith('--reason=')) {
args.reason = arg.split('=')[1];
} else if (arg === '--strategy') {
args.strategy = argv[++i];
} else if (arg.startsWith('--strategy=')) {
args.strategy = arg.split('=')[1];
} else if (arg === '--status') {
args.status = argv[++i];
} else if (arg.startsWith('--status=')) {
args.status = arg.split('=')[1];
}
}