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]>
- Updated `.hero h1` with a multi-stop animated gradient background.
- Added `@keyframes textShine` for the text gradient animation.
- Enhanced the background SVG with a `heroGlow` radial gradient and a large animated circle to provide a subtle ambient glow behind the hero section.
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]>
- Added `npm run scheduler:daily` to docs
- Added `npm run scheduler:weekly` to docs
- Added `npm run lock:complete` to docs
- Generated task log and artifacts for docs-alignment-agent run
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extracted `RelayHealthManager` to `src/relay-health-manager.mjs`
- Extracted `LockPublisher` to `src/lock-publisher.mjs`
- Moved shared utilities to `src/lock-utils.mjs`
- Updated `src/lock-ops.mjs` to import dependencies and re-export public API
- Reduced `src/lock-ops.mjs` from 880 to 152 lines
- Verified with tests (295 passed) and linting
Co-authored-by: PR0M3TH3AN <[email protected]>
This change updates the `torch init` command to:
1. Prompt the user for a Nostr hashtag (defaulting to `${namespace}-agent-lock`).
2. Explicitly save the `hashtag` to `torch-config.json` under `dashboard.hashtag` for easier editing.
3. Generate a `TORCH_DASHBOARD.md` file in the installation directory containing a link to the TORCH dashboard with the correct `hashtag`, `namespace`, and `relays` pre-filled.
This improves the onboarding experience by making it easier to find and monitor the agent locks immediately after initialization.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `src/utils.mjs` to detect `gemini` and `antigravity` platforms via environment variables.
- Update `dashboard/styles.css` with new color utilities for purple and pink themes.
- Update `dashboard/app.js` to map Goose, Gemini, and Antigravity platforms to distinct badge colors.
- Update `test/utils.test.mjs` to include unit tests for the new platform detection logic.
This ensures all active agent platforms are correctly identified and labeled in the TORCH dashboard.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added missing copy of `src/constants.mjs` to test fixture in `test/scheduler-preflight-lock.e2e.test.mjs`
- Verified fix with `npm run test:integration:e2e`
Co-authored-by: PR0M3TH3AN <[email protected]>
- Add Gemini CLI card to landing/index.html
- Update selectAgent function to support Gemini
- Verified visually via Playwright script
Co-authored-by: PR0M3TH3AN <[email protected]>
- Moved the "Scheduler Meta Prompts" section to be above the "Functional Agents" section in `landing/index.html`.
- Added "Antigravity IDE" as a new option in the "Choose Your Agent" section with a corresponding install prompt.
- Verified changes with Playwright script and manual inspection of the HTML structure.
- Tests passed.
Co-authored-by: PR0M3TH3AN <[email protected]>
Adds a detailed architectural opinion/RFC in `docs/TORCH_EVOLUTION_CONCEPT.md` outlining the transition from a linear scheduler to a node-based workflow orchestrator. This document includes recommendations for UI (React Flow), integrations (OpenClaw, ClaudeCode CLI), and a phased roadmap.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updates `test/run-scheduler-cycle-memory-policy.test.mjs` to copy `src/utils.mjs`, `src/torch-config.mjs`, `src/constants.mjs`, `src/relay-health.mjs`, and `src/lock-ops.mjs` to the temporary test environment.
- Symlinks `node_modules` into the test environment to resolve external dependencies (e.g., `nostr-tools`).
- Resolves `ERR_MODULE_NOT_FOUND` errors during CI.
- Includes Protocol Research Agent daily run artifacts (Protocol Inventory update and Report).
Co-authored-by: PR0M3TH3AN <[email protected]>
Executed style-agent for daily cadence.
Ran npm run lint (and --fix), npm run build, and npm test.
Verified no style issues were auto-fixable.
Created completion log.
Co-authored-by: PR0M3TH3AN <[email protected]>
Explicitly defaults `AGENT_PLATFORM` to `'codex'` in the test environment for `run-scheduler-cycle-memory-policy.test.mjs`. This resolves assertion failures where tests expected platform metadata (e.g., `platform: 'codex'`) but received `'unknown'` in CI environments where the variable is unset.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Explicitly sets `AGENT_PLATFORM: 'codex'` in `test/run-scheduler-cycle-memory-policy.test.mjs` for tests that assert platform-specific output.
- Resolves CI failures where `detectPlatform` was falling back to `'unknown'` or the host environment's platform, causing assertion mismatches.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Addresses `ERR_MODULE_NOT_FOUND` in `test/run-scheduler-cycle-memory-policy.test.mjs` caused by missing dependency in the temporary test environment.
- Ensures `src/utils.mjs` is available for `scripts/agent/run-scheduler-cycle.mjs` during test execution.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `.prompts-grid` to use `minmax(280px, 1fr)` instead of `400px` to fit mobile screens.
- Add media query to reduce `.meta-prompts` padding on small screens.
- Add `word-break: break-all` and `overflow-wrap: break-word` to `#promptModal` code blocks to prevent horizontal overflow.
Co-authored-by: PR0M3TH3AN <[email protected]>
Resolves `ERR_MODULE_NOT_FOUND` in `run-scheduler-cycle-memory-policy.test.mjs` by explicitly copying `src/utils.mjs` to the temporary test directory structure, satisfying the import dependency of `scripts/agent/run-scheduler-cycle.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Execute `perf-agent` as part of the daily schedule.
- Generate performance reports `reports/performance/hits-2026-02-19.json` and `reports/performance/daily-perf-report-2026-02-19.md`.
- Create required run artifacts in `src/context/`, `src/todo/`, `src/decisions/`, and `src/test_logs/` with strict metadata.
- Validate run artifacts and linting.
- Publish task completion via `torch-lock`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updated `test/scheduler-preflight-lock.e2e.test.mjs` to expect `detectPlatform() || 'unknown'` instead of hardcoding `'codex'`.
- This ensures the test passes in CI environments where `detectPlatform()` returns `null`, causing the script to default to `'unknown'`, as well as in local environments where it detects a platform like `'jules'`. This aligns with the updated default logic in `run-scheduler-cycle.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updated `test/scheduler-preflight-lock.e2e.test.mjs` to expect `detectPlatform() || 'codex'` instead of hardcoding `'codex'`.
- This ensures the test passes when running in environments where the platform is correctly detected (e.g., 'jules'), aligning with the changes made in the previous commit.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updated `src/utils.mjs` to detect 'claude' platform via `CLAUDE_API_KEY`, `ANTHROPIC_API_KEY`, or `CLAUDE_SESSION_ID`.
- Updated `scripts/agent/scheduler-utils.mjs` `getSafeEnv` to preserve `JULES_`, `CODEX_`, `CLAUDE_`, `ANTHROPIC_`, and `GOOSE_` environment variables when spawning child processes.
- Updated `scripts/agent/run-scheduler-cycle.mjs` to use `detectPlatform()` as a fallback for `AGENT_PLATFORM` instead of hardcoding `'codex'`, ensuring the correct platform is used for lock creation.
- Added unit tests for `detectPlatform` in `test/utils.test.mjs`.
- Fixed `test/scheduler-lock-failure-schema.contract.test.mjs` to include `src/utils.mjs` in the temporary test environment, resolving `ERR_MODULE_NOT_FOUND`.
This resolves the issue where lock cards displayed "Unknown" or incorrect platforms and fixes the resulting CI failure.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updated `src/utils.mjs` to detect 'claude' platform via `CLAUDE_API_KEY`, `ANTHROPIC_API_KEY`, or `CLAUDE_SESSION_ID`.
- Updated `scripts/agent/scheduler-utils.mjs` `getSafeEnv` to preserve `JULES_`, `CODEX_`, `CLAUDE_`, `ANTHROPIC_`, and `GOOSE_` environment variables when spawning child processes.
- Updated `scripts/agent/run-scheduler-cycle.mjs` to use `detectPlatform()` as a fallback for `AGENT_PLATFORM` instead of hardcoding `'codex'`, ensuring the correct platform is used for lock creation.
- Added unit tests for `detectPlatform` in `test/utils.test.mjs`.
This resolves the issue where lock cards displayed "Unknown" or incorrect platforms.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `.github/workflows/ci.yml` to run build, lint, and test on PRs/push to main.
- Updated `.github/workflows/ci-resilience-nightly.yml` to use Node.js 22.
- Fixed lint errors in `src/services/governance/index.js` (no-empty, preserve-caught-error).
- Added `governance-agent` to daily roster and scheduler prompt to fix `npm test` scheduler validation failure.
Co-authored-by: PR0M3TH3AN <[email protected]>
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]>
- Create scripts/agent/load-test.mjs with nostr-tools and ws.
- Generate load test report in reports/load-test/.
- Verify with dry run.
- Scheduler cycle completion log for load-test-agent.
Co-authored-by: PR0M3TH3AN <[email protected]>
This change updates the landing page (`landing/index.html`) to group functional agents into "TORCH Maintenance & Agent Evolution" and "Repo Development" categories, instead of the default "Daily" and "Weekly" schedule-based grouping.
- Introduced `AGENT_CATEGORIES` mapping in `landing/index.html`.
- Updated `fetchAgents` to flatten the roster and group by functional category.
- Preserved the "Daily"/"Weekly" badge on agent cards.
- Verified changes with a Playwright script checking for the presence of new category headers.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Optimized `RelayHealthManager.rankRelays` to use O(M log M) lookup for small subsets instead of O(N) filter.
- Added `byRelay` Map to `_sortedCache` for O(1) access.
- Fixed `NaN` bug in `buildRelayHealthConfig` when `minActiveRelayPool` is undefined.
- Updated `perf/benchmark-lock-ops.mjs` to measure subset performance.
- Added performance report `reports/performance/weekly-perf-report-2026-02-18.md`.
- Achieved ~6.8x speedup in benchmark.
Co-authored-by: PR0M3TH3AN <[email protected]>
The landing page (`landing/index.html`) relies on fetching `roster.json` and agent markdown files from `src/prompts/`. Previously, the build process did not copy these files to the `dist/` directory, causing 404 errors on the hosted landing page.
This change:
- Modifies `build.mjs` to recursively copy `src/prompts/` to `dist/src/prompts/`.
- Updates `build.mjs` to replace `../src/prompts/` paths in `landing/index.html` with `src/prompts/` during the build, ensuring correct path resolution when served from `dist/`.
- Removes the individual `META_PROMPTS.md` copy step as it is now covered by the directory copy.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Refactored `test/memory-scheduler.test.mjs` to use `mock.timers` for deterministic execution, replacing flaky `wait` logic.
- Strengthened `test/lock-ops.test.mjs` with edge case tests for `parseLockEvent` handling invalid JSON and missing fields.
- Fixed a security vulnerability in `src/dashboard.mjs` where sensitive configuration (e.g., rosters, auth) was exposed in `/torch-config.json`.
- Updated `src/prompts/daily/test-audit-agent.md` to comply with the canonical prompt contract.
- Added `reports/test-audit/test-integrity-note-2025-02-14.yaml` detailing test changes and anti-cheat measures.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added "Clean Repo Standard" to `AGENTS.md` and `CLAUDE.md`, explicitly forbidding root-level logs/artifacts.
- Moved clutter files (`test_output_full.txt`, `benchmark-after.txt`, `dashboard.log`, etc.) to `test_logs/`, `task-logs/`, and `reports/performance/`.
- Moved `INITIAL_BASELINE.md` and other baseline files to `reports/performance/`.
- Updated `src/prompts/daily/perf-agent.md` and `src/prompts/daily/const-refactor-agent.md` to reference the new location of `INITIAL_BASELINE.md`.
- Updated `.gitignore` to ignore logs and temporary artifacts in the new directories.
- Moved `DIAGNOSIS.md` to `reports/performance/`.
- Moved `perf/` data files to `reports/performance/`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `reports/` directory with subdirectories for each category (audit, performance, security, etc.).
- Moved existing reports to the new `reports/` structure.
- Updated `AGENTS.md` to define the "Report Location Standard".
- Updated all agent prompts in `src/prompts/` to:
- Output reports to the new locations.
- Fix incorrect script paths (replaced `torch/scripts/` with `scripts/`).
- Updated `load-test-agent.md` to produce a Markdown summary report.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `AGENTS.md` and `CLAUDE.md` to define test integrity rules and behavior-based validation.
- Updated `TORCH.md` to include "Scenario-First Tests & Test Integrity" and the "Test Integrity & Scenario Spec Agent" role.
- Updated `src/prompts/daily/test-audit-agent.md` to adopt the new "Enforcer" role, prioritizing test fidelity over CI green state.
- Preserved existing scheduler contract headers in the agent prompt.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added JSDoc to exported functions and classes in src/lock-ops.mjs
- Added inline comments to complex logic areas
- Created docs/lock-ops-overview.md
- Created task log for daily docs-code-investigator agent
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `package.json` to include `TORCH.md` and `scripts/memory/` in distribution.
- Update `README.md` to reference `TORCH.md` correctly.
- Update `src/ops.mjs` to robustly handle memory policy paths in `torch-config.json` generation.
- Update `.gitignore` to exclude `.scheduler-memory/`.
- Update `torch-config.example.json` to include memory policy with standard defaults.
Co-authored-by: PR0M3TH3AN <[email protected]>
Optimizes `saveMemoryStore` in `src/services/memory/index.js` to use `fs.promises.writeFile` instead of synchronous `fs.writeFileSync`.
Implements a coalescing mechanism to handle concurrent save requests efficiently, preventing race conditions and reducing I/O operations by batching pending updates into a single write.
Reduces event loop blocking from ~420ms (sync) to ~3ms (async) for large write operations in benchmarks.
Updates all `memoryRepository` methods to await the async save operation.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implement caching for `rankRelays` to avoid redundant sorting and computations.
- Cache is invalidated on new outcomes or when quarantine status changes.
- Add `_metricsVersion` to track metrics updates.
- Benchmarks show ~3x performance improvement (0.06ms -> 0.02ms per call for 100 relays).
- Add unit tests for caching behavior and invalidation.
- Add `perf/benchmark-lock-ops.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Use Promise.all to execute memory lifecycle actions concurrently.
- Maintain intra-item dependency order (merged_into before action).
- Update tests to support non-deterministic execution order of independent items.
- Benchmark shows ~65x improvement for 100 items with 10ms latency.
Co-authored-by: PR0M3TH3AN <[email protected]>
Avoids redundant string concatenation and lowercasing in the inner loop of `buildSimilarityIndex`.
Pre-computes query terms and regexes once per query.
Uses RegExp.test for case-insensitive matching without allocation.
Benchmark shows ~2x speedup (99ms vs 191ms for 10k memories).
Co-authored-by: PR0M3TH3AN <[email protected]>
- Replaced brittle regex-based sanitization with `path.resolve` relative to `packageRoot`.
- Added `test/dashboard-path-traversal-fix.test.mjs` to verify robust protection against traversal attacks.
- Verified that legitimate access to allowed paths is maintained.
- Verified that access to restricted files (like package.json) is blocked.
- Updated path handling to correctly handle absolute paths and URL-encoded characters.
This change addresses a potential security vulnerability where the previous sanitization logic could be bypassed in certain environments or with specific edge cases. By using standard path resolution and explicitly checking against a canonical root, the implementation is more secure and maintainable.
Co-authored-by: PR0M3TH3AN <[email protected]>
Refactored `src/cmd-list.mjs` to use a `Set` for roster lookups, reducing complexity from O(M*N) to O(M+N).
Added dependency injection to `cmdList` to enable unit testing.
Added `test/cmd-list.test.mjs` to verify functionality.
Co-authored-by: PR0M3TH3AN <[email protected]>
Sorts memories by created_at and uses an early exit condition in the inner loop to avoid checking all pairs. This reduces complexity from O(N^2) to roughly O(N * k) where k is the number of items within the duplicate window.
Measured improvement for 30k items: ~2.1s -> ~0.25s (8x speedup).
Co-authored-by: PR0M3TH3AN <[email protected]>
Restrict the /torch-config.json endpoint to only return fields required by the dashboard frontend (dashboard config excluding auth, and nostrLock namespace/relays). This prevents exposure of sensitive internal configuration such as rosters, scheduler settings, and full relay lists.
- Modify src/dashboard.mjs to sanitize config using an allowlist approach.
- Add test/dashboard-config-exposure.test.mjs to verify sensitive fields are stripped.
Co-authored-by: PR0M3TH3AN <[email protected]>
Adds standard HTTP security headers (CSP, X-Content-Type-Options, X-Frame-Options, Referrer-Policy) to all dashboard responses to mitigate XSS, clickjacking, and MIME sniffing attacks.
Includes verification tests in test/dashboard-security.test.mjs.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Refactor `src/roster.mjs` to support dependency injection for `fs` and `loadTorchConfig`.
- Add `test/roster.test.mjs` to test roster loading scenarios including file precedence, caching, fallback, and configuration overrides.
- Export `_resetRosterCache` in `src/roster.mjs` for testing purposes.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `validateInstallDir` function to `src/ops.mjs` to enforce strict allowlist for directory names (alphanumeric, hyphens, underscores, slashes, periods).
- Integrated validation into `resolveConfiguration` to sanitize both interactive and mock inputs.
- Added comprehensive unit tests in `test/install_dir_validation.test.mjs`.
This fixes a vulnerability where malicious directory names could inject shell commands into `package.json` scripts during initialization.
Co-authored-by: PR0M3TH3AN <[email protected]>
Moved the `ensureDir` utility function from `src/ops.mjs` to `src/utils.mjs` to promote code reuse and centralization.
Updated `src/ops.mjs` and `src/services/memory/index.js` to use the shared utility.
Added unit tests for `ensureDir` in `test/utils.test.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Verified by:
- Searching the codebase to confirm no imports.
- Running the tests to ensure no regressions.
- Running the build to ensure the process is unaffected.
Co-authored-by: PR0M3TH3AN <[email protected]>
Add comprehensive unit tests for `todayDateStr` and `nowUnix` in `src/utils.mjs`.
These tests use `node:test`'s mock timers to ensure deterministic execution, verifying
that the date formatting and timestamp generation behave as expected.
- `todayDateStr`: verified correct YYYY-MM-DD format
- `nowUnix`: verified correct integer timestamp generation
Co-authored-by: PR0M3TH3AN <[email protected]>
- Remove `src/cmd-check.mjs` as it is not used in the codebase and contains outdated logic.
- Remove `test/cmd-check.test.mjs` as it tests the deleted file.
- Verify that `cmdCheck` in `src/lib.mjs` is covered by `test/lib.test.mjs`.
This improves code health by removing unused and duplicate code.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Executed design-system-audit-agent on daily cadence
- Generated design system audit report (memory-update.md)
- Created run artifacts in src/context, src/todo, src/decisions, src/test_logs
- Published lock completion and final task log
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `CONTRIBUTING.md` with development instructions.
- Updated `README.md` to include a Development section.
- Added daily scheduler run artifacts.
- Completed scheduler cycle for `docs-agent`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Ran design-system-audit-agent.
- Audited landing/index.html for inline styles and design system violations.
- Applied safe auto-fixes to landing/index.html (margins, colors, text alignment).
- Generated audit report in task-logs/daily/.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Executed daily scheduler cycle.
- Selected `decompose-agent` (next in roster).
- Decomposed `scripts/agent/run-scheduler-cycle.mjs` (1127 lines) into `scripts/agent/scheduler-utils.mjs` (195 lines) and `scripts/agent/scheduler-lock.mjs` (173 lines).
- Resulting main file size: 788 lines (339 lines reduction).
- Fixed lint warnings.
- Updated `test/scheduler-preflight-lock.e2e.test.mjs`, `test/run-scheduler-cycle-memory-policy.test.mjs`, `test/scheduler-lock-failure-schema.contract.test.mjs` to copy new modules into test fixtures.
- Updated `test/scheduler-ratchet.test.mjs` to verify moved functions in `scheduler-lock.mjs`.
- Note: `scripts/check-file-size.mjs` was not updated as it lacks the baseline feature referenced in the prompt.
- Created artifacts: `src/context/CONTEXT_...`, `src/decisions/DECISIONS_...`, `src/test_logs/TEST_LOG_...`, `src/todo/TODO_...`.
- Created scheduler log: `task-logs/daily/2026-02-17T22-29-00Z__decompose-agent__completed.md`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Audited `/content` directory: Not found.
- Updated `KNOWN_ISSUES.md`.
- Fixed a bug in `src/lock-ops.mjs` where `deps` was undefined in `LockPublisher`.
- Created run artifacts and task logs.
Co-authored-by: PR0M3TH3AN <[email protected]>
`frontend-console-debug-agent` run:
- Fixed a 403 Forbidden error in `src/dashboard.mjs` preventing `src/constants.mjs` from loading by adding it to the `allowedPaths` whitelist.
- Refactored `src/lock-ops.mjs` to fix a critical syntax error in `LockPublisher` class.
- Fixed a typo in `src/cmd-check.mjs` (`queryLocksFn` -> `queryLocks`).
- Added `@playwright/test` for frontend debugging.
- Added `scripts/agent/debug_frontend.mjs` for reproduction.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extracted hardcoded retry/health constants from `src/lock-ops.mjs` to `src/constants.mjs`.
- Refactored `src/lock-ops.mjs` to use `LockPublisher` class pattern and shared constants.
- Fixed `SyntaxError` in `src/lock-ops.mjs` (function inside function).
- Fixed `ReferenceError` in `src/cmd-check.mjs` (`queryLocksFn` -> `queryLocks`).
- Verified with unit tests (`test:unit:lock-backend`) and linting.
- Completed daily scheduler cycle for `const-refactor-agent`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces synchronous `fs.readFileSync` with `fs.promises.readFile` in `loadTorchConfig` to prevent event loop blocking.
Updates all dependent configuration getters and consumers to use async/await.
Includes benchmark proving non-blocking behavior.
Fixes dashboard tests to properly await server listening.
Co-authored-by: PR0M3TH3AN <[email protected]>
Prevent sensitive environment variables from leaking into child processes spawned by the scheduler. Introduce `getSafeEnv` whitelist and default `runCommand` to use it. Explicitly allow system, node, CI, and application-specific (NOSTR_, TORCH_, SCHEDULER_, AGENT_) variables. Removed `inheritProcessEnv: true` from user commands to enforce this security policy. Added `Path` support for Windows.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `test/memory-run-prune-cycle.test.mjs` to test `runPruneCycle` logic.
- Covered active pruning, dry-run, off mode, telemetry/metrics, and scheduling.
- Utilized environment isolation (temp dir) to prevent side effects on `.scheduler-memory/memory-store.json`.
- Addressed testing gap for `runPruneCycle` in `src/services/memory/index.js`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Replaces module-level mutable state (`metricsByRelay`, `lastSnapshotAt`) with `RelayHealthManager` class.
- Moves state-dependent functions (`ensureRelayMetrics`, `rankRelaysByHealth`, etc.) to class methods.
- Updates `queryLocks` and `publishLock` to support dependency injection for `healthManager`.
- Maintains backward compatibility via `defaultHealthManager` singleton.
- Adds `test/relay-health-manager.test.mjs` to verify state isolation and functionality.
Co-authored-by: PR0M3TH3AN <[email protected]>