Fix host-repo scheduler flow and init lint compatibility

This commit is contained in:
thePR0M3TH3AN committed 2026-02-25 14:36:29 -05:00
1 parent ad8b8012d7
commit 723d9c8b53
6 files changed
+38 -29

No files matched your search

+1
View File
@@ -42,6 +42,7 @@
"skills/",
"dashboard/",
"assets/",
"eslint.config.mjs",
"torch-config.example.json",
"README.md",
"TORCH.md",
+2 -2
View File
@@ -61,7 +61,7 @@ const invariants = [
],
flow: [
'Roster source: `src/prompts/roster.json`',
'Read `scheduler.firstPromptByCadence.<cadence>` from `torch-config.json` if present.',
'Read `scheduler.firstPromptByCadence.<cadence>` from repository-root `torch-config.json` if present.',
'All roster tasks currently claimed by other agents',
],
},
@@ -119,7 +119,7 @@ const invariants = [
meta: [
'If any validation command exits non-zero, do not call `lock:complete`',
'Publish completion before writing `_completed.md`',
'Only after step 10 succeeds, write final task log (`_completed.md`',
'Only after step 11 succeeds, write final task log (`_completed.md`',
],
flow: [
'step 12 MUST NOT be executed (`lock:complete` is forbidden until validation passes)',
+1 -1
View File
@@ -53,7 +53,7 @@ const EVOLVING_DIRS = ['daily', 'weekly'];
const APP_DIRS = ['src', 'bin', 'dashboard', 'landing', 'assets', 'scripts'];
/** Individual files to sync from package root to install directory. */
const APP_FILES = ['package.json', 'build.mjs', 'README.md', 'torch-config.example.json', 'TORCH.md'];
const APP_FILES = ['package.json', 'build.mjs', 'README.md', 'torch-config.example.json', 'TORCH.md', 'eslint.config.mjs'];
/**
* Resolves the absolute paths for the installation.
+32 -24
View File
@@ -21,7 +21,10 @@ MUST 0: Normalize execution context before any other step:
- `script_prefix = npm run --prefix torch`
- `path_prefix = torch/`
- Else stop and report: `Unable to locate TORCH scheduler files (checked src/prompts and torch/src/prompts).`
- Ensure dependencies are installed before continuing:
- If `<path_prefix>node_modules` does not exist, run `npm install` (host-repo mode example: `npm install --prefix torch`).
- Apply `script_prefix` to every `lock:*` command below and apply `path_prefix` to every repository path below.
- `torch-config.json` is always resolved at repository root (do not apply `path_prefix` to it).
MUST 1: Set cadence config to:
- cadence = daily
@@ -48,7 +51,7 @@ MUST 3: Run these commands in this order:
a) YAML frontmatter key `agent`.
b) Filename format `<timestamp>__<agent-name>__<status>.md`.
- If no valid previous log exists (missing file, parse failure, or agent not in roster):
- Read `scheduler.firstPromptByCadence.daily` from `<path_prefix>torch-config.json` if present.
- Read `scheduler.firstPromptByCadence.daily` from `torch-config.json` (repository root) if present.
- If that agent is in roster, start there.
- Otherwise set `start_index = 0`.
- Else set `start_index = (index(previous_agent)+1) mod roster_length`.
@@ -62,27 +65,28 @@ MUST 3: Run these commands in this order:
5) Claim via repository lock:
AGENT_PLATFORM=<platform> <script_prefix> lock:lock -- --agent <agent-name> --cadence daily
Exit 0 = lock acquired, proceed. Exit 3 = race lost, go back to step 3.
6) Execute selected prompt from <path_prefix>src/prompts/daily/ (spawned agent work only; completion publish and final task log writing remain scheduler-owned)
7) Run required memory workflow for this cadence:
6) Run required memory workflow for this cadence:
- Before execution, run the retrieval command if configured:
`scheduler.memoryPolicyByCadence.daily.retrieveCommand`
- After execution, run the storage command if configured:
`scheduler.memoryPolicyByCadence.daily.storeCommand`
- Emit or collect verifiable evidence for both steps using configured markers/artifacts.
8) Validate memory evidence:
7) Execute selected prompt from <path_prefix>src/prompts/daily/ (spawned agent work only; completion publish and final task log writing remain scheduler-owned)
8) After execution, run the storage command if configured:
- `scheduler.memoryPolicyByCadence.daily.storeCommand`
- Emit or collect verifiable evidence for both retrieval and storage steps using configured markers/artifacts.
9) Validate memory evidence:
- Confirm retrieval evidence exists (marker and/or artifact file).
- Confirm storage evidence exists (marker and/or artifact file).
- If `scheduler.memoryPolicyByCadence.daily.mode` is `required`, fail the run if either check is missing.
9) Run repository checks (for example: npm run lint)
10) Run repository checks (for example: npm run lint)
- Do not apply `script_prefix` to repository checks unless you explicitly intend to validate the TORCH package itself.
- If any validation command exits non-zero, do not call `lock:complete`.
- Instead, write `_failed.md` with the failing command and reason, then stop.
10) Publish completion before writing `_completed.md` (only after step 9 passes):
11) Publish completion before writing `_completed.md` (only after step 10 passes):
AGENT_PLATFORM=<platform> <script_prefix> lock:complete -- --agent <agent-name> --cadence daily
(Equivalent command allowed: torch-lock complete --agent <agent-name> --cadence daily)
- Exit 0: continue.
- Exit non-zero: fail the run, write `_failed.md` with a clear completion-publish failure reason and retry guidance, then stop.
11) Only after step 10 succeeds, write final task log (`_completed.md` for success). For any failure in step 9 or step 10, write `_failed.md`, then stop.
12) Print a final summary message to stdout.
12) Only after step 11 succeeds, write final task log (`_completed.md` for success). For any failure in step 10 or step 11, write `_failed.md`, then stop.
13) Print a final summary message to stdout.
- Status: [Success/Failure]
- Agent: [Agent Name]
- Prompt: [Prompt Path]
@@ -99,7 +103,7 @@ MUST 3: Run these commands in this order:
Worked example (failed validation, no completion publish):
- `AGENT_PLATFORM=codex <script_prefix> lock:lock -- --agent content-audit-agent --cadence daily`
- execute selected prompt work
- `<script_prefix> lint` exits non-zero (or `<script_prefix> test` exits non-zero)
- `npm run lint` exits non-zero (or `npm run test` exits non-zero)
- write `<path_prefix>task-logs/daily/<timestamp>__content-audit-agent__failed.md` with failure reason
- stop without running `AGENT_PLATFORM=codex <script_prefix> lock:complete -- --agent content-audit-agent --cadence daily`
- print final summary (Status: Failed, Reason: <reason>)
@@ -124,7 +128,10 @@ MUST 0: Normalize execution context before any other step:
- `script_prefix = npm run --prefix torch`
- `path_prefix = torch/`
- Else stop and report: `Unable to locate TORCH scheduler files (checked src/prompts and torch/src/prompts).`
- Ensure dependencies are installed before continuing:
- If `<path_prefix>node_modules` does not exist, run `npm install` (host-repo mode example: `npm install --prefix torch`).
- Apply `script_prefix` to every `lock:*` command below and apply `path_prefix` to every repository path below.
- `torch-config.json` is always resolved at repository root (do not apply `path_prefix` to it).
MUST 1: Set cadence config to:
- cadence = weekly
@@ -151,7 +158,7 @@ MUST 3: Run these commands in this order:
a) YAML frontmatter key `agent`.
b) Filename format `<timestamp>__<agent-name>__<status>.md`.
- If no valid previous log exists (missing file, parse failure, or agent not in roster):
- Read `scheduler.firstPromptByCadence.weekly` from `<path_prefix>torch-config.json` if present.
- Read `scheduler.firstPromptByCadence.weekly` from `torch-config.json` (repository root) if present.
- If that agent is in roster, start there.
- Otherwise set `start_index = 0`.
- Else set `start_index = (index(previous_agent)+1) mod roster_length`.
@@ -165,27 +172,28 @@ MUST 3: Run these commands in this order:
5) Claim via repository lock:
AGENT_PLATFORM=<platform> <script_prefix> lock:lock -- --agent <agent-name> --cadence weekly
Exit 0 = lock acquired, proceed. Exit 3 = race lost, go back to step 3.
6) Execute selected prompt from <path_prefix>src/prompts/weekly/ (spawned agent work only; completion publish and final task log writing remain scheduler-owned)
7) Run required memory workflow for this cadence:
6) Run required memory workflow for this cadence:
- Before execution, run the retrieval command if configured:
`scheduler.memoryPolicyByCadence.weekly.retrieveCommand`
- After execution, run the storage command if configured:
`scheduler.memoryPolicyByCadence.weekly.storeCommand`
- Emit or collect verifiable evidence for both steps using configured markers/artifacts.
8) Validate memory evidence:
7) Execute selected prompt from <path_prefix>src/prompts/weekly/ (spawned agent work only; completion publish and final task log writing remain scheduler-owned)
8) After execution, run the storage command if configured:
- `scheduler.memoryPolicyByCadence.weekly.storeCommand`
- Emit or collect verifiable evidence for both retrieval and storage steps using configured markers/artifacts.
9) Validate memory evidence:
- Confirm retrieval evidence exists (marker and/or artifact file).
- Confirm storage evidence exists (marker and/or artifact file).
- If `scheduler.memoryPolicyByCadence.weekly.mode` is `required`, fail the run if either check is missing.
9) Run repository checks (for example: npm run lint)
10) Run repository checks (for example: npm run lint)
- Do not apply `script_prefix` to repository checks unless you explicitly intend to validate the TORCH package itself.
- If any validation command exits non-zero, do not call `lock:complete`.
- Instead, write `_failed.md` with the failing command and reason, then stop.
10) Publish completion before writing `_completed.md` (only after step 9 passes):
11) Publish completion before writing `_completed.md` (only after step 10 passes):
AGENT_PLATFORM=<platform> <script_prefix> lock:complete -- --agent <agent-name> --cadence weekly
(Equivalent command allowed: torch-lock complete --agent <agent-name> --cadence weekly)
- Exit 0: continue.
- Exit non-zero: fail the run, write `_failed.md` with a clear completion-publish failure reason and retry guidance, then stop.
11) Only after step 10 succeeds, write final task log (`_completed.md` for success). For any failure in step 9 or step 10, write `_failed.md`, then stop.
12) Print a final summary message to stdout.
12) Only after step 11 succeeds, write final task log (`_completed.md` for success). For any failure in step 10 or step 11, write `_failed.md`, then stop.
13) Print a final summary message to stdout.
- Status: [Success/Failure]
- Agent: [Agent Name]
- Prompt: [Prompt Path]
@@ -202,7 +210,7 @@ MUST 3: Run these commands in this order:
Worked example (failed validation, no completion publish):
- `AGENT_PLATFORM=codex <script_prefix> lock:lock -- --agent bug-reproducer-agent --cadence weekly`
- execute selected prompt work
- `<script_prefix> lint` exits non-zero (or `<script_prefix> test` exits non-zero)
- `npm run lint` exits non-zero (or `npm run test` exits non-zero)
- write `<path_prefix>task-logs/weekly/<timestamp>__bug-reproducer-agent__failed.md` with failure reason
- stop without running `AGENT_PLATFORM=codex <script_prefix> lock:complete -- --agent bug-reproducer-agent --cadence weekly`
- print final summary (Status: Failed, Reason: <reason>)
+1 -2
View File
@@ -141,8 +141,7 @@ Every agent prompt invoked by the schedulers (daily/weekly) MUST enforce this co
2. Otherwise parse filename convention `<timestamp>__<agent-name>__<status>.md` and take `<agent-name>`.
- If no valid `latest_file` exists, or parsing fails, or `previous_agent` is not in `roster`, treat as first run fallback.
- First run fallback:
- Read `scheduler.firstPromptByCadence.<cadence>` from `torch-config.json` if present.
- In host-repo mode, resolve this as `<path_prefix>torch-config.json`.
- Read `scheduler.firstPromptByCadence.<cadence>` from repository-root `torch-config.json` if present.
- If that agent exists in `roster`, set `start_index = index(configured_agent)`.
- Otherwise set `start_index = 0`.
- Otherwise: `start_index = (index(previous_agent in roster) + 1) mod len(roster)`.
+1
View File
@@ -33,6 +33,7 @@ test('cmdInit creates directory structure and files', async () => {
assert.ok(fs.existsSync(path.join(torchDir, 'prompts', 'daily')), 'daily prompts created');
assert.ok(fs.existsSync(path.join(torchDir, 'roster.json')), 'roster created');
assert.ok(fs.existsSync(path.join(torchDir, 'META_PROMPTS.md')), 'META_PROMPTS.md created');
assert.ok(fs.existsSync(path.join(torchDir, 'eslint.config.mjs')), 'eslint config copied');
// Check content transformation
const metaPrompts = fs.readFileSync(path.join(torchDir, 'META_PROMPTS.md'), 'utf8');