Skip to content

fix(loop): raise the journal budget to hold a twelve-run day - #55

Merged
Ardnived merged 1 commit into
mainfrom
claude/raise-journal-budget
Sep 6, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/raise-journal-budget

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Sunday's reflect, over 2026-08-30 → 2026-09-05. Seven journals, 56 runs.

Grading last week

There was no reflection PR last week. reflect landed in #32 on 2026-09-02, after the previous Sunday, and journal #6 records that Sunday's run never fired at all: "There was no morning run today, so Sunday's weekly reflect did not happen."

The nearest thing to a prior reflection is the two fixes journal #9 named "both for the Sunday reflection". Both shipped in #48 / #8, so both are gradable:

Change Verdict
"Never time a GitHub job by the local clock" → preflight's "Prefer a wake event's current-time over the local clock" and "You cannot detect having been blocked" Held. No clock-misread claim appears in any of the six journals since 2026-08-31. The failure it addressed (a 12-minute CI run read as a one-hour hang) did not recur
"ciPollNote states a false premise… decide what the loop does with a subscription it did not create" → preflight's "Declining to call it is not enough… Tolerate that… then unsubscribe" Held. Journal #27 records the new path running end to end on SahajAtlasWordpress#10 — auto-subscribed at open, answered the wake's one real ask, unsubscribed. No recurrence since

The change

writing.budgets.journalComment: 2500 → 4000. One value, in the two places that state it.

The evidence is Saturday's journal measured against its own budget. #51 is 2480 characters — 99.2% of 2500 — and it reaches that number only after deleting things the format requires:

  • the mandated | Run | Window | table is absent entirely
  • 1 📄 Did line survives, for a 12-run day
  • the body records the compression as it happened: "📄 Did and the run table were already gone, so 23:31 dropped 10 older lines; 01:11 merged two ceiling lines and rewrote two more to fit one run"

📄 Did is the designed relief valve — GitHub already records those events, so the journal's own rule cuts them first. The failure is that the valve was fully spent before the budget stopped biting, so runs began compressing ⏭️ Ceiling and ⚠️ Failed. Those are the sections the journal exists for, and they are reflect's only input.

That cost landed on this run. Saturday's friction line reads "journalComment (2500) cannot hold the day — 8th time" and names six timestamps. The other two occurrences cannot be dated, because the lines that would have named their day were cut to fit. A recurrence count this survey could not compute is exactly what the budget destroyed.

4000 is derived, not picked:

chars
Irreducible record on the worst day so far — header, ⚠️ Failed, ⏭️ Ceiling, 🧭 Friction, 12 runs ~2325
Run table, grouped-window style ~110
Remainder for 📄 Did — about 8–13 lines ~1565

So 4000 restores the run table and most of a full day's entries, and keeps 📄 Did the first thing cut on a heavier day. It does not make the budget generous; it makes the relief valve exist again.

workflow/lib/budget.mjs's DEFAULT_BUDGETS moves with it, and it is the only half of this diff that takes effect today. budget.mjs:70 calls require('node:fs') inside an ESM module, where require is undefined. That throws a ReferenceError into the bare catch on every invocation, from every directory, so writing.budgets has never overridden DEFAULT_BUDGETS. Verified against main: a loop-config.json holding journalComment: 9999 beside the process still prints OK — 1/2500.

The two values must agree either way, so this PR still moves both. The loop-config.json half stays inert until that read is repaired — a second behaviour, in its own PR. An earlier version of this body claimed a two-path check that could not have failed. The review thread on budget.mjs:32 records the correction.

workflow/skills/journal/SKILL.md:16 states 2,500 a third time, in prose. Dropping it is a skill edit, which CLAUDE.md forbids from riding a ceiling change, so it is left to a standalone PR.

Cost, stated plainly. About 375 tokens per journal read. preflight has every run read the last entry, so roughly 4500 tokens a day at the current cadence. That is the price of reflect being able to count.

No skill file is touched, so this is a ceiling change alone, as CLAUDE.md requires — and rule-delta.mjs has nothing to measure. claude plugin validate ./workflow --strict passes. version → 0.2.4, since workflow/lib/ is cached by an installed plugin.

Observed, and deliberately not acted on

Each of these is named with its count, and none licenses a change yet.

  • wipCapPerRepo (3) was the binding constraint in SahajCloud on 2 days (Fri 13:00–01:12; Sat 22:21, 23:31, 01:11 — "Nothing implementable for three runs"). I am not raising it. All three open SahajCloud PRs (#711, #712, #714) carry zero human reviews, so the constraint is review capacity, not the cap. Raising it would stack a fourth unreviewed PR on the same bottleneck.
  • The migration contract step failed on 3 distinct days (Thu, Fri, Sat). timeout 30 sits below the command's own ~3-minute boot, so exit 124 no longer discriminates a drizzle prompt from a slow start. Filed as SahajCloud#716 — it needs .claude/workflow.json edited, which an unattended run must not touch.
  • rule-delta.mjs --base main reads a stale local main in a fresh clone — Sat, and reproduced live here: origin/main was at e939bb7 (feat(state): a workflow owns the mechanical state; the loop keeps judgement #44) while main was at e3e3802 (feat(state): assign the bot to its own PR, once, at open #53), 5 commits apart, until this run fetched. 2 days. The fix is tooling, not a ceiling, so it cannot ride this PR. Next week's candidate.
  • No PostgreSQL in the sandbox — Tue, then Sat, and confirmed again today (pg_isready → no response). SahajCloud's integration lane cannot run here. #679 fixed this on Wed and it did not hold.
  • SahajCloud CLAUDE.md says ask before filing an issue; the skills file anyway — Sat only, 3 occurrences (#704, #713, #715). One day. Real contradiction, but resolving it is a decision about which document wins, not a docs typo.
  • Rung 4 assumes the state machine sets Revising on issue_comment: created — Sat only, 2 occurrences.
  • Blocked tickets write Blocked by sydevs/X#N., not relationships.bodyMarkerFormat — Sat only, on 4 tickets.
  • A run between 00:00 and 07:00 UTC is still the previous Vancouver day, so its HH:MM sorts before every earlier run — Sat only.
  • work-routine:213 vs :234 on writing awaiting in rung 4 — Sat, 2 occurrences. Already fixed in the open fix(loop): let rung 4 write awaiting, and narrow its prohibition to Stage #54; nothing to add.

Reviewer profile — no edit

assignment.reviewer wrote 6 inline comments across 2 PRs in the window (SahajCloud#681 ×4, #686 ×2). Every one maps onto a value the profile already states:

  • "This is a flat renaming of something we've already defined", "We want to avoid re-exporting types which are derived from the generated types", "Isn't this just an indirect redefinition of Event['schedule']?" → values 1 and 4.
  • "Could this file be converted into a more generic 'update by field' helper?" → value 1's bimodal taste, verbatim.
  • "It seems excessive and it seems to duplicate the domain of the access plugin. We need a… simpler and easy to maintain system" → value 3.

The adversarial review independently raised two of the four on #681, which the thread records at the time. No new value appeared, and no comment contradicts one, so the recurrence gate does not open. The profile held.

One fact worth recording for next Sunday: the reviewer's last four reviews (#698, #700, #703, and the second pass on #692) were bare approvals with no text. If that continues, the profile has no new evidence to learn from, and the honest verdict each week will be "no edit".


🤖 Generated with Claude Code

https://claude.ai/code/session_0166cCCtAb7HM22dk1s6zbRa

`writing.budgets.journalComment` was 2500. Saturday's journal
(claude-workflow#51) measured 2480 — 99.2% of budget — with the
mandated run table deleted and 11 of that day's 12 `📄 Did` lines
already dropped. The body records the compression itself: `23:31`
dropped ten older lines, and `01:11` merged two `⏭️ Ceiling` lines and
rewrote two more to fit one run's entries.

That is the failure this prevents. `📄 Did` is the designed relief
valve, and it was fully spent before the budget stopped biting, so
runs began compressing `⏭️ Ceiling` and `⚠️ Failed` — the sections
the journal exists for, and `/workflow:reflect`'s only input. Today's
reflection could not date two of the eight recorded `journalComment`
occurrences, because the lines naming their day had been cut.

Sized from the measurement, not chosen. The irreducible record on the
worst day so far — header, `⚠️ Failed`, `⏭️ Ceiling`, `🧭 Friction` —
is about 2325 characters at 12 runs. Adding the run table (~110)
leaves ~1565 for `📄 Did`, roughly 8-13 lines. So 4000 restores the
run table and most of a full day's entries while keeping `📄 Did` the
first thing cut on a heavier day.

`workflow/lib/budget.mjs`'s DEFAULT_BUDGETS moves with it. That
fallback is live, not theoretical: the script resolves
`loop-config.json` relative to the working directory, so a run
invoking it from anywhere else silently measured against 2500. Both
paths now report 4000 for the same input.

Cost: about 375 tokens per journal read, and `/workflow:preflight`
has every run read the last entry — roughly 4500 tokens a day at the
current cadence.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0166cCCtAb7HM22dk1s6zbRa

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

Three lines, one value, no skill body: the diff is the size of the problem, and the version bump is required because workflow/lib/ ships in the cached plugin. The evidence holds — journal #51 measures ~2,513 chars, run table gone, one 📄 Did line for 12 runs. One question, not a finding: 4,000 is derived for a 12-run day and the cost scales with runs, so this raises a ceiling, not the format. Dropping the mandated run table would cost nothing per run — does this PR return on a 16-run day?

Findings

  • should-fix — workflow/lib/budget.mjs:32: loop-config.json is never read, so the body's two-path check could not have failed.
  • consider — loop-config.json:153: journal/SKILL.md:16 still states this value as 2,500.

Checked — the diff (+3/−3); budget.mjs whole, plus two live CLI runs with a planted loop-config.json; every other statement of the value (grep → journal/SKILL.md:16,19,22, preflight/SKILL.md:37; none in docs/why.md); marketplace.json (no version); get_reviews → empty. Profile read.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread workflow/lib/budget.mjs Resolved
Comment thread loop-config.json
"comment": 1200,
"reviewReply": 600,
"journalComment": 2500
"journalComment": 4000

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider — a third place states this number, and it did not move. workflow/skills/journal/SKILL.md:16 reads "A rewritten document holds the same facts in about 2,500 characters."

journal loads on every run, so it now names 2,500 six lines above the command that allows 4,000. That sentence was redundant before this PR; it is wrong after it, and CLAUDE.md's rule is the one it breaks — nothing in a skill hard-codes a number. Dropping the figure is the whole fix.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, deferred. CLAUDE.md forbids a skill change riding a ceiling change, and this PR's argument rests on touching no skill file.

The figure should go whether or not this lands, so it is standalone, not a follow-up. wipCapPerRepo is spent once the budget.mjs repair opens, so a later run takes it.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Revised. The body is corrected and both threads are answered. No code change — the diff is unchanged.

The budget.mjs finding holds, and the body was wrong about the mechanism. require is undefined in an .mjs module, so the config read threw a ReferenceError into the bare catch on every call, from every directory. writing.budgets has never overridden DEFAULT_BUDGETS. The two-path evidence block asserted a check that could not fail, and is gone.

That leaves DEFAULT_BUDGETS as the only half of this diff that takes effect today. The repair is #58, branched off main — the two land in either order.

journal/SKILL.md:16 states 2,500 a third time, and it stays. Dropping it is a skill edit, and CLAUDE.md forbids one riding a ceiling change. It is standalone work either way — nothing in a skill hard-codes a number, whether or not this lands — so a later run takes it. wipCapPerRepo is spent now that #58 is open.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Correction to my last comment here. It said #58 and this PR "land in either order". They do not.

Both branch from e3e3802, and both rewrite version in workflow/.claude-plugin/plugin.json. I ran git merge-tree between the two branches rather than take #58's word: a content conflict on that file alone, and budget.mjs merges clean.

CONFLICT (content): Merge conflict in workflow/.claude-plugin/plugin.json

main holds 0.2.3. This PR takes 0.2.4. #58 takes 0.2.5.

Whichever lands second must resolve to the higher version. If this one lands second and keeps its own 0.2.4, main moves backwards, and a plugin already cached at 0.2.5 never sees this change.

So resolve to 0.2.5 here if #58 lands first. A gap at 0.2.4 costs nothing — the cache key must change, not stay contiguous.

#58's body states the same rule.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@Ardnived
Ardnived merged commit cba8664 into main Sep 6, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in SYDevelopers Technical Roadmap Sep 6, 2026
@Ardnived Ardnived removed the awaiting label Sep 6, 2026
@Ardnived
Ardnived deleted the claude/raise-journal-budget branch September 6, 2026 18:00
Ardnived added a commit that referenced this pull request Sep 6, 2026
… did (#58)

* fix(loop): read loop-config.json in budget.mjs, which require() never did

`budget.mjs:70` called `require('node:fs')` inside an ESM module. `require`
is undefined there, so the line threw a `ReferenceError` into the bare
`catch` on every invocation, from every directory. `writing.budgets` has
therefore never overridden `DEFAULT_BUDGETS`. Every budget the loop has
measured was the fallback, and tuning `loop-config.json` did nothing.

The failure is silent by construction: the catch has no message, and the
two numbers agree today, so a check from either path returned the same
answer for the wrong reason. #55 raises `journalComment` in
`loop-config.json` and would have had no effect at all.

`loadLoopConfig()` in `lib/config.mjs` already resolves the file correctly:
it walks up from the cwd, then from its own location. Reusing it also drops
a second, worse copy of that lookup — the old line read `loop-config.json`
relative to the process, so even a working `require` would have missed it
from any other directory.

The `catch` stays, and now has one job. An installed plugin caches
`workflow/` alone, with no `loop-config.json` above it, so `loadLoopConfig`
throws there and `DEFAULT_BUDGETS` is the answer.

Verified in all three shapes. A `loop-config.json` holding
`journalComment: 9999` beside the process printed `2500` before and `9999`
after. The repo root still reads `2500` from config. A copy of `workflow/`
alone, run from `/tmp`, falls back to `2500` and `600`.

`version` → 0.2.5, since `workflow/lib/` ships in the plugin cache. It
skips 0.2.4, which the open #55 takes.

Found by the adversarial review on #55.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WtYsgJTcXzU2unVFtxkJqz

* fix(loop): name which path set the budget, and stop hiding a broken config

The review found the catch still swallowed a real failure. A
loop-config.json that EXISTS and will not parse threw out of JSON.parse,
landed in the same catch, and the run measured DEFAULT_BUDGETS with
nothing printed — the exact shape this PR indicts.

The printed line carried the same gap. `OK — 1/2500` never said whether
the config or the fallback produced the 2500, which is why demonstrating
the original bug needed an out-of-tree 9999 probe.

Both close together. The CLI now names its source, and a config that is
present but unreadable says so instead of falling back quietly:

  OK — 1/2500 (config)
  OK — 1/2500 (fallback)
  OK — 1/2500 (fallback, loop-config.json unreadable: <parse error>)

Exit codes are unchanged, so no caller's contract moves.

The docblock also stopped asserting that a plugin cache ships `workflow/`
alone. No cache exists in any environment available to this run, so that
was an inference. The source label is what will answer it from a real
installed run.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016FZreqxKVR4MJ197gecH2D

---------

Co-authored-by: sydevs-bot <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: sydevs-bot <[email protected]>
Co-authored-by: Devindra Payment <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants