Users who installed TORCH via `npm install <tarball> && npx torch-lock init` had no built-in way to cleanly remove it. This adds a `remove` command that detects and removes all TORCH artifacts: the torch/ directory, config files, runtime directories (.torch/, .scheduler-memory/, task-logs/), governance proposals, host package.json scripts, and the npm package itself. - Add cmdRemove() in src/ops.mjs with detection, preview, confirmation, and cleanup - Wire up `remove` command in CLI dispatcher (src/lib.mjs) - Add TORCH_HOST_SCRIPTS constant in constants.mjs for shared script key list - Add docs/removal.md with full manual removal instructions - Add removal section to README.md - Add 7 scenario tests in test/ops-remove.test.mjs https://claude.ai/code/session_011Snrxu3iZGLtJ9pnFSajpM
3.7 KiB
Removing TORCH from a Project
This guide covers how to completely remove TORCH from a project repository that installed it via the standard installation process (npm install <torch-tarball> && npx torch-lock init).
Quick Removal (Recommended)
Run the built-in removal command from your project root:
npx torch-lock remove
This will:
- Detect your TORCH installation (whether installed to
torch/or to the project root) - Show a list of all artifacts that will be removed
- Ask for confirmation before deleting anything
- Remove all TORCH files, directories, configuration, and the npm package
To skip the confirmation prompt:
npx torch-lock remove --force
What Gets Removed
The remove command cleans up everything that torch-lock init created, plus any runtime artifacts:
| Artifact | Description |
|---|---|
torch/ |
The main TORCH install directory (contains src, bin, dashboard, scripts, prompts, etc.) |
torch-config.json |
TORCH configuration file at the project root |
.torch/ |
Hidden directory for prompt history tracking |
.scheduler-memory/ |
Runtime memory store used by the memory subsystem |
task-logs/ |
Scheduler run logs (daily/weekly cycle logs, relay health history) |
src/proposals/ |
Governance proposals directory |
torch:* scripts in package.json |
Convenience scripts injected into the host project's package.json |
node_modules/torch-lock/ |
The installed npm package |
Manual Removal
If you prefer to remove TORCH manually, or if the remove command is unavailable (e.g., the package was already uninstalled), follow these steps from your project root:
1. Remove the TORCH directory
rm -rf torch/
2. Remove TORCH configuration
rm -f torch-config.json
3. Remove hidden directories
rm -rf .torch/
rm -rf .scheduler-memory/
4. Remove runtime logs
rm -rf task-logs/
5. Remove governance proposals (if empty/unused)
# Only remove if this directory was created by TORCH and contains no user content
rm -rf src/proposals/
# Remove src/ too if it's now empty
rmdir src/ 2>/dev/null
6. Clean up package.json scripts
Remove these keys from the "scripts" section of your package.json:
{
"torch:dashboard": "...",
"torch:check": "...",
"torch:lock": "...",
"torch:health": "...",
"torch:memory:list": "...",
"torch:memory:inspect": "..."
}
7. Uninstall the npm package
npm uninstall torch-lock
8. Clean up environment variables (if set)
If you configured TORCH environment variables in your shell profile, CI, or .env files, remove them:
NOSTR_LOCK_NAMESPACENOSTR_LOCK_HASHTAGNOSTR_LOCK_RELAYSNOSTR_LOCK_TTLNOSTR_LOCK_QUERY_TIMEOUT_MSNOSTR_LOCK_DAILY_ROSTERNOSTR_LOCK_WEEKLY_ROSTERTORCH_CONFIG_PATHTORCH_DASHBOARD_AUTHTORCH_MEMORY_ENABLEDTORCH_MEMORY_INGEST_ENABLEDTORCH_MEMORY_RETRIEVAL_ENABLEDTORCH_MEMORY_PRUNE_ENABLEDAGENT_PLATFORM
9. Optional: Remove generated reports
If you ran lock reliability reports, you may also want to remove:
rm -rf artifacts/lock-reliability/
Verifying Complete Removal
After removal, verify no TORCH artifacts remain:
# Should return no results
ls torch/ 2>/dev/null
ls .torch/ 2>/dev/null
ls .scheduler-memory/ 2>/dev/null
ls torch-config.json 2>/dev/null
# Should not contain torch-lock
npm ls torch-lock 2>/dev/null
# Should not contain torch:* scripts
grep '"torch:' package.json
Re-installing TORCH
If you want to re-install TORCH later:
npm install https://github.com/PR0M3TH3AN/TORCH/archive/refs/heads/main.tar.gz && npx torch-lock init