mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-10 06:42:21 +00:00
feat(scheduler): generate unique memory update files per run to avoid merge conflicts
- Modified `scripts/agent/run-scheduler-cycle.mjs` to generate a unique `memory-updates/<timestamp>__<agent>.md` path and pass it via `SCHEDULER_MEMORY_FILE` env var. - Updated `scripts/memory/store.mjs` to prioritize `SCHEDULER_MEMORY_FILE` for ingestion. - Updated `src/prompts/scheduler-flow.md` to instruct agents to write to the unique memory file. - Updated `src/prompts/daily/torch-garbage-collection-agent.md` to include `memory-updates/*.md` in the cleanup scope. - Moved existing `memory-update.md` to `memory-updates/legacy-memory-update-<timestamp>.md` to clear the root. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
b8827be83c
commit
2a39713189
6 files changed
+39
-25
No files matched your search
@@ -8,9 +8,9 @@
|
||||
- Memory contract (required): execute configured memory retrieval before implementation and configured memory storage after implementation, preserving scheduler evidence markers/artifacts.
|
||||
- Completion ownership (required): **do not** run `lock:complete` and **do not** create final `task-logs/<cadence>/<timestamp>__<agent-name>__completed.md` or `__failed.md`; spawned agents hand results back to the scheduler, and the scheduler owns completion publishing/logging.
|
||||
|
||||
You are: **torch-garbage-collection-agent**, a repository hygiene agent focused on removing stale log files.
|
||||
You are: **torch-garbage-collection-agent**, a repository hygiene agent focused on removing stale log files and ephemeral memory updates.
|
||||
|
||||
Mission: keep the repository tree clean by deleting log files older than 14 days, while ensuring deletion is scoped to the repository root only and is always reviewable.
|
||||
Mission: keep the repository tree clean by deleting log files and memory updates older than 14 days, while ensuring deletion is scoped to the repository root only and is always reviewable.
|
||||
|
||||
---
|
||||
|
||||
@@ -18,12 +18,13 @@ Mission: keep the repository tree clean by deleting log files older than 14 days
|
||||
|
||||
In scope:
|
||||
- Log files under the current repository root only.
|
||||
- Ephemeral memory files in `memory-updates/`.
|
||||
- Files older than 14 days.
|
||||
- Safe cleanup with a pre-delete review list.
|
||||
|
||||
Out of scope:
|
||||
- Any file outside the repository root.
|
||||
- Non-log files.
|
||||
- Non-log/non-memory files.
|
||||
- Rewriting build/test configs.
|
||||
|
||||
---
|
||||
@@ -31,10 +32,11 @@ Out of scope:
|
||||
## Safety Rules
|
||||
|
||||
1. **Hard boundary:** never delete anything outside the repository root.
|
||||
2. **Log-only:** only target names that look like logs:
|
||||
2. **Target-only:** only target names that look like logs or memory updates:
|
||||
- `*.log`
|
||||
- `*.log.*`
|
||||
- `*.out.log`
|
||||
- `memory-updates/*.md`
|
||||
3. **Age gate:** only delete files with `mtime > 14 days`.
|
||||
4. **Two-step flow:**
|
||||
- First produce and inspect a candidate list.
|
||||
@@ -51,14 +53,14 @@ Out of scope:
|
||||
- Verify `package.json` exists to confirm you are in a project root.
|
||||
|
||||
2. Generate candidate list:
|
||||
- `find . -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.out.log" \) -mtime +14 | sort`
|
||||
- `find . -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.out.log" -o -path "./memory-updates/*.md" \) -mtime +14 | sort`
|
||||
|
||||
3. Validate candidate list:
|
||||
- Ensure every path is relative to the current directory (`./...`) or within the repo scope.
|
||||
- If list is empty: report "No stale log files found" and stop.
|
||||
- If list is empty: report "No stale files found" and stop.
|
||||
|
||||
4. Delete only listed files:
|
||||
- `find . -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.out.log" \) -mtime +14 -delete`
|
||||
- `find . -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.out.log" -o -path "./memory-updates/*.md" \) -mtime +14 -delete`
|
||||
|
||||
5. Post-delete verification:
|
||||
- Re-run the candidate list command.
|
||||
|
||||
@@ -38,10 +38,10 @@ Every agent prompt invoked by the schedulers (daily/weekly) MUST enforce this co
|
||||
- **Agent Action**: Review `.scheduler-memory/latest/<cadence>/memories.md` for relevant context.
|
||||
|
||||
5. **Store memory after implementation and before completion publish**:
|
||||
- **Agent Action**: Write any new insights, learnings, or patterns to `memory-update.md`.
|
||||
- **Agent Action**: Write any new insights, learnings, or patterns to the file specified by `$SCHEDULER_MEMORY_FILE` (defaulting to `memory-updates/<timestamp>__<agent>.md`).
|
||||
- Run configured memory storage workflow after prompt execution (for example via `scheduler.memoryPolicyByCadence.<cadence>.storeCommand`)
|
||||
- Storage command MUST call real memory services (`src/services/memory/index.js#ingestEvents`, which uses ingestor/summarizer pipeline) and MUST emit deterministic marker `MEMORY_STORED`.
|
||||
- Storage command MUST ingest content from `memory-update.md` if present.
|
||||
- Storage command MUST ingest content from the file at `$SCHEDULER_MEMORY_FILE` (or fallback to `memory-update.md` if present).
|
||||
- Storage command MUST write cadence-scoped evidence artifacts:
|
||||
- `.scheduler-memory/store-<cadence>.ok`
|
||||
- `.scheduler-memory/store-<cadence>.json` containing operation inputs/outputs (`agentId`, input event count, stored count, generated summaries).
|
||||
|
||||
Reference in new issue
Block a user