docs: surface prompt versioning and backup in README and TORCH.md

- README.md: add "Prompt Governance & Versioning CLI" and "State Backup
  CLI" sections under Usage with full command examples and link to
  docs/prompt-versioning.md
- TORCH.md: add "Prompt Versioning & State Backup" section with
  proposal→apply→rollback cycle, backup command reference, and link to
  docs/prompt-versioning.md

https://claude.ai/code/session_01Ndq2D72Kp77BYo4owD63uY
This commit is contained in:
Claude committed 2026-02-20 02:36:22 +00:00
1 parent 54818a624c
commit 63ed863e1a
2 files changed
+96

No files matched your search

+48
View File
@@ -84,6 +84,54 @@ npx --no-install torch-lock unpin-memory --id <memory-id>
npx --no-install torch-lock memory-stats
```
### Prompt Governance & Versioning CLI
Agent prompts are changed through a governance workflow that archives the previous version before overwriting, enabling full rollback.
```bash
# Propose a change to an agent prompt
npx --no-install torch-lock proposal create \
--agent my-agent \
--target src/prompts/daily/my-agent.md \
--content /path/to/new-content.md \
--reason "Add missing EXIT CRITERIA section"
# List pending proposals
npx --no-install torch-lock proposal list
npx --no-install torch-lock proposal list --status pending
# Inspect or apply a proposal
npx --no-install torch-lock proposal show --id <proposal-id>
npx --no-install torch-lock proposal apply --id <proposal-id>
npx --no-install torch-lock proposal reject --id <proposal-id> --reason "..."
# List available archived versions of a prompt
npx --no-install torch-lock rollback --target src/prompts/daily/my-agent.md --list
# Roll back to the most recent archived version
npx --no-install torch-lock rollback --target src/prompts/daily/my-agent.md
# Roll back to a specific version by hash fragment
npx --no-install torch-lock rollback --target src/prompts/daily/my-agent.md --strategy <hash>
```
### State Backup CLI
Snapshot agent runtime state (long-term memory and scheduler state) to a timestamped directory under `.torch/backups/`.
```bash
# Create a snapshot
npx --no-install torch-lock backup
# List existing snapshots
npx --no-install torch-lock backup --list
# Write snapshot to a custom directory
npx --no-install torch-lock backup --output /path/to/backup-dir
```
See [docs/prompt-versioning.md](docs/prompt-versioning.md) for the full workflow, restore procedure, and storage layout.
### Configuration (`torch-config.json`)
Create a `torch-config.json` file in your project root to configure TORCH for your repository. You can use the included `torch-config.example.json` as a template.
+48
View File
@@ -425,6 +425,54 @@ The lock CLI resolves roster names in this order:
3. Preserve database state for post-incident analysis; do not drop or rewrite memory tables during rollback.
4. Keep prune actions in `dry-run` (or disabled) until lifecycle policy and data integrity are revalidated.
## Prompt Versioning & State Backup
### How prompt changes are governed
Every agent prompt in `src/prompts/daily/` and `src/prompts/weekly/` must be changed through the governance workflow — direct file edits skip the archive and break rollback lineage.
**Proposal → Apply → Rollback cycle:**
```bash
# 1. Propose a change
torch-lock proposal create \
--agent <agent> \
--target src/prompts/daily/<agent>.md \
--content /path/to/new.md \
--reason "reason"
# 2. Review and apply
torch-lock proposal list --status pending
torch-lock proposal show --id <id>
torch-lock proposal apply --id <id> # archives old version, writes new
torch-lock proposal reject --id <id> --reason "..."
# 3. Inspect available versions
torch-lock rollback --target src/prompts/daily/<agent>.md --list
# 4. Roll back (defaults to most recent archive; falls back to git)
torch-lock rollback --target src/prompts/daily/<agent>.md
torch-lock rollback --target src/prompts/daily/<agent>.md --strategy <hash>
```
Archives are stored in `.torch/prompt-history/` with filenames that embed an ISO timestamp and SHA-256 hash (`<base>_<ts>_<hash>.md`) alongside a `.meta.json` sidecar recording who applied the change, why, and when.
### State backup
Runtime state lives outside git. Snapshot it before destructive operations or on a schedule:
```bash
torch-lock backup # creates .torch/backups/<timestamp>/
torch-lock backup --list # list all snapshots
```
Files captured per snapshot:
- `.scheduler-memory/memory-store.json` (agent long-term memory)
- `task-logs/daily/.scheduler-run-state.json` (scheduler deferral state)
See [docs/prompt-versioning.md](docs/prompt-versioning.md) for the full reference including restore steps and storage layout.
## Offline & Air-Gapped Installation
TORCH is designed to operate in diverse environments, including high-security, air-gapped, or offline networks where direct access to the npm registry is restricted.