mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-09 06:12:15 +00:00
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:
1 parent
470093d9ad
commit
64b6f43df1
8 files changed
+606
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { rollbackPrompt } from './services/governance/index.js';
|
||||
import { ExitError } from './errors.mjs';
|
||||
|
||||
export async function cmdRollback(target, strategy) {
|
||||
if (!target) {
|
||||
console.error('Usage: torch-lock rollback --target <path> [--strategy <hash|latest>]');
|
||||
throw new ExitError(1, 'Missing target');
|
||||
}
|
||||
|
||||
const effectiveStrategy = strategy || 'latest';
|
||||
|
||||
try {
|
||||
const result = await rollbackPrompt(target, effectiveStrategy);
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
} catch (e) {
|
||||
console.error(`Rollback failed: ${e.message}`);
|
||||
throw new ExitError(1, 'Rollback failed');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user