- Scanned codebase for `setInterval`, `Promise.all`, and other async patterns.
- Generated `reports/performance/hits-2026-02-20.json`.
- Identified potential unbounded concurrency in `src/services/memory`.
- Created daily performance report.
- Updated run artifacts and memory.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implemented throttling in `performSave` to limit disk writes to max 1 per second.
- Refactored `updateMemoryUsage` to use non-blocking (fire-and-forget) save calls, eliminating latency for memory reads.
- Added atomic write strategy using unique temporary files and `fs.rename` to prevent data corruption.
- Verified with benchmarks: `getRelevantMemories` latency reduced from ~100ms to ~30ms for 10k items.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extracted command logic from `src/lib.mjs` `main` function into `COMMAND_HANDLERS` dispatch map.
- Simplified `main` function to perform argument parsing and dispatching.
- Added `test/main-dispatch.test.mjs` to verify dispatch logic and error handling.
- Ensured no regressions in CLI behavior.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extracted `PUBLISH_ERROR_CODES`, `PUBLISH_FAILURE_CATEGORIES`, and `classifyPublishError` to `src/lock-error-classifier.mjs`.
- Moved `secureRandom` to `src/lock-utils.mjs`.
- Updated `src/lock-publisher.mjs` and `src/lock-ops.mjs` to import shared utilities from `src/lock-utils.mjs`.
- Reduced `src/lock-publisher.mjs` size significantly (approx. 100 lines) and verified `src/lock-ops.mjs` remains small.
- Verified that tests pass and file sizes are reduced.
Co-authored-by: PR0M3TH3AN <[email protected]>
Moved the duplicate `withTimeout` function from `src/lock-ops.mjs`, `src/lock-publisher.mjs`, `src/lock-utils.mjs`, and `src/relay-health.mjs` to a single definition in `src/utils.mjs`.
Updated all references to import from `src/utils.mjs`. `src/lock-utils.mjs` re-exports `withTimeout` for backward compatibility.
Added unit tests for `withTimeout` in `test/utils.test.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Moved `mergeRelayList` from `src/lock-ops.mjs` and `src/lock-publisher.mjs` to `src/utils.mjs`.
- Updated imports in `src/lock-ops.mjs` and `src/lock-publisher.mjs`.
- Added unit tests for `mergeRelayList` in `test/utils.test.mjs`.
- Restored `torch-config-test.json` which was deleted by the test suite.
Co-authored-by: PR0M3TH3AN <[email protected]>
Updates `validateProposal` to accept either a proposal ID or a proposal object.
Updates `applyProposal` to pass the already-fetched proposal object to `validateProposal`,
eliminating a redundant file system read. This improves efficiency and code health.
Tests were verified to ensure no regression.
Co-authored-by: PR0M3TH3AN <[email protected]>
Marks pending items in `src/todo/TODO_2026-02-19T22-29-56Z.md` as completed since they were flagged as N/A by the agent. This ensures the todo list accurately reflects the run status.
Co-authored-by: PR0M3TH3AN <[email protected]>
The unequal-length branch of timingSafeCompare called
crypto.timingSafeEqual(paddedA, paddedB) but did not capture the return
value, unconditionally returning false and leaving the timing-safe
comparison as dead code.
Adds a regression test covering shorter, longer, and exact-match
credential lengths to lock in the correct behaviour.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- run-selected-prompt.mjs: set SCHEDULER_MEMORY_FILE env var before spawning each agent so
store.mjs has a well-known path to read from (memory-updates/<ts>__<agent>.md)
- retrieve.mjs: format memories.md using m.summary + date/tags in readable markdown sections
instead of raw m.content blobs; agents can now scan injected context at a glance
- store.mjs: remove semantically-empty fallback placeholder events that polluted the store
and degraded retrieval quality; also fix default cadence 'weekly' -> 'daily' to match retrieve
- scheduler-flow.md: replace vague "write insights" instruction with a concrete three-section
template (Key findings / Patterns / Warnings) and clarify that $SCHEDULER_MEMORY_FILE is
set by the scheduler automatically
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Added features/diagnostic.mjs to help users verify their local TORCH environment.
Includes checks for Node.js version, dependencies, configuration, and connectivity.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `scheduler:daily` and `scheduler:weekly` usage examples to README.md and TORCH.md.
- Added `lock:complete` and `lock:check:daily` usage examples to README.md and TORCH.md.
- Updated TODO list to reflect completion of documentation alignment.
- Verified script presence and syntax.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implemented LexicalIndex class in src/services/memory/retriever.js.
- Added WeakMap caching for indices based on memory array references.
- Improved memory array stability in src/services/memory/index.js using a storeVersion counter.
- Achieved ~2x speedup for 10k memories and ~9x speedup for 100k memories in benchmarks.
- Maintains compatibility with existing textMatchSimilarity scoring.
Co-authored-by: PR0M3TH3AN <[email protected]>
Extracted duplicated target path resolution and allowlist validation logic
into a shared `resolveAndValidateTarget` helper function in
`src/services/governance/index.js`.
Updated `createProposal`, `validateProposal`, `applyProposal`, and
`rollbackPrompt` to use the new helper, ensuring consistent validation
and path handling across the service.
Added `test/governance-health.test.mjs` to verify validation logic.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `test/errors.test.mjs` with comprehensive tests for the `ExitError` class.
- Updated `src/errors.mjs` to set `this.name = 'ExitError'` in the constructor for better error reporting.
- Verified that all new tests pass and no regressions were introduced to the existing test suite.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaced `execSync` with `execFileSync` in `src/services/governance/index.js` to avoid shell interpretation of variable-derived inputs (such as agent IDs and file targets). This mitigates command injection risks in `createProposal`, `applyProposal`, and `rollbackPrompt`.
- Used `execFileSync` for all git operations.
- Updated logic to correctly handle `git diff` exit code 1.
- Removed unused `execSync` import.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updates `cmdInit` to output the Nostr hashtag, namespace, and a direct dashboard URL upon completion.
- Refactors `createDashboardLinkFile` to return the generated URL for console output.
- Ensures the initialization process provides clear next steps for both human users and agents.
Co-authored-by: PR0M3TH3AN <[email protected]>