-
Notifications
You must be signed in to change notification settings - Fork 50
feat(sweep): archive closed deferred-work entries so the ledger stays proportional to open work #711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sweep): archive closed deferred-work entries so the ledger stays proportional to open work #711
Changes from all commits
b4c17df
f2a9877
acc1071
32f5d36
92817ec
e207623
531ac26
29ab301
c992147
f1f08b0
746d27d
3900379
9168c0f
f898f5e
a4c9ba4
8b4e5fc
9498b51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,13 @@ are `### DW-<n>:` blocks whose `status:` line is `open`. If the ledger is | |
| missing or unreadable, escalate `CRITICAL` (`type: missing-ledger`) per | ||
| automation-mode.md and end your turn. | ||
|
|
||
| An entry carrying an `archived:` line keeps only a stub here — its full body | ||
| lives in the sibling `deferred-work-archive.md`, keyed by the same DW- id; read | ||
| it there before classifying that entry. An `archived-body:` line says the same | ||
| of an entry that was archived and later reopened: it is live work again, but the | ||
| body it carried before that close is still in the archive file, in the block | ||
| stamped with the date the line carries. | ||
|
Comment on lines
+38
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target skill ---'
sed -n '1,90p' src/bmad_loop/data/skills/bmad-loop-sweep/SKILL.md
printf '%s\n' '--- format references ---'
fd -i 'deferred-work-format.md' . -t f -x sh -c 'echo "--- $1"; cat -n "$1"' sh {}
printf '%s\n' '--- archive_closed references ---'
rg -n -C 5 'archive_closed|same.?date|closure.?order|reopen|archived-body|deferred-work-archive' . \
-g '!node_modules' -g '!dist' -g '!build'Repository: bmad-code-org/bmad-loop Length of output: 50382 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- exact references ---'
rg -l -F 'archive_closed' . -g '!node_modules' -g '!dist' -g '!build' | sort
printf '%s\n' '--- archive-related source and tests ---'
rg --files | rg '(^|/)(deferred|archive|sweep)|test.*(deferred|archive|sweep)|sweep.*test'Repository: bmad-code-org/bmad-loop Length of output: 656 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- archive implementation symbols ---'
ast-grep outline src/bmad_loop/deferredwork.py
printf '%s\n' '--- archive implementation matches ---'
rg -n -C 12 'archive_closed|archived-body|deferred-work-archive|archived:' src/bmad_loop/deferredwork.py
printf '%s\n' '--- archive tests ---'
rg -n -C 15 'archive_closed|archived-body|same.?date|reopen|archive' tests/test_deferredwork.py tests/test_sweep.py tests/test_sweep_skill_contract.pyRepository: bmad-code-org/bmad-loop Length of output: 50380 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- archive test names ---'
rg -n '^def test_.*(archive|archived|reopen)|same.?day|same.?date' tests/test_deferredwork.py tests/test_sweep.py
printf '%s\n' '--- archive test section ---'
python3 - <<'PY'
from pathlib import Path
p = Path("tests/test_deferredwork.py")
lines = p.read_text(encoding="utf-8").splitlines()
for i, line in enumerate(lines):
if line.startswith("def test_") and any(x in line for x in ("archive", "archived", "reopen")):
lo = max(0, i - 2)
hi = min(len(lines), i + 45)
print(f"\n--- lines {lo+1}-{hi} ---")
for n in range(lo, hi):
print(f"{n+1}: {lines[n]}")
PYRepository: bmad-code-org/bmad-loop Length of output: 50382 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- same-date archive tests ---'
sed -n '2938,3110p' tests/test_deferredwork.py
printf '%s\n' '--- skill contract checks for archive guidance ---'
rg -n -C 8 'archived-body|deferred-work-archive|archive|last|closure' tests/test_sweep_skill_contract.pyRepository: bmad-code-org/bmad-loop Length of output: 9183 🏁 Script executed: #!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re
skill = Path("src/bmad_loop/data/skills/bmad-loop-sweep/SKILL.md").read_text(encoding="utf-8")
fmt = Path("src/bmad_loop/data/skills/bmad-loop-sweep/deferred-work-format.md").read_text(encoding="utf-8")
tests = Path("tests/test_deferredwork.py").read_text(encoding="utf-8")
excerpt = "\n".join(skill.splitlines()[37:43])
assert "last" not in excerpt.lower()
assert "same DW- id" in excerpt
assert "narrow by the date" in fmt
assert "take the **last** of them" in fmt
assert "archive file's append order" in tests
assert "test_archive_same_day_reclosures_resolve_by_append_order" in tests
archive = """\
### DW-1: item
status: done 2026-06-11
resolution: first close
archived: 2026-08-24
### DW-1: item
status: done 2026-06-12
resolution: second close
archived: 2026-08-24
"""
blocks = re.split(r"(?=^### DW-\d+:)", archive, flags=re.MULTILINE)
matches = [
block for block in blocks
if block.startswith("### DW-1:")
and "archived: 2026-08-24" in block
]
assert len(matches) == 2
assert "resolution: second close" in matches[-1]
print("skill excerpt omits the tie-break")
print("format and same-day test require the last matching archive block")
print("same-ID, same-date selection resolves to the later appended block")
PYRepository: bmad-code-org/bmad-loop Length of output: 250 🏁 Script executed: #!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re
skill = Path("src/bmad_loop/data/skills/bmad-loop-sweep/SKILL.md").read_text(encoding="utf-8")
fmt = Path("src/bmad_loop/data/skills/bmad-loop-sweep/deferred-work-format.md").read_text(encoding="utf-8")
tests = Path("tests/test_deferredwork.py").read_text(encoding="utf-8")
excerpt = "\n".join(skill.splitlines()[37:43])
checks = {
"skill excerpt omits last": "last" not in excerpt.lower(),
"skill excerpt identifies date": "same DW- id" in excerpt,
"format narrows by date": "Narrow by the date" in fmt,
"format selects last": "take the **last** of them" in fmt,
"test checks append order": "tie-break the format documents is the archive's append order" in tests,
"same-day test exists": "test_archive_same_day_reclosures_resolve_by_append_order" in tests,
}
for name, passed in checks.items():
print(f"{name}: {passed}")
assert passed, name
archive = """\
### DW-1: item
status: done 2026-06-11
resolution: first close
archived: 2026-08-24
### DW-1: item
status: done 2026-06-12
resolution: second close
archived: 2026-08-24
"""
blocks = re.split(r"(?=^### DW-\d+:)", archive, flags=re.MULTILINE)
matches = [
block for block in blocks
if block.startswith("### DW-1:")
and "archived: 2026-08-24" in block
]
assert len(matches) == 2
assert "resolution: second close" in matches[-1]
print("same-ID, same-date selection resolves to the later appended block")
PYRepository: bmad-code-org/bmad-loop Length of output: 394 🏁 Script executed: #!/bin/bash
set -eu
sed -n '41,60p' src/bmad_loop/data/skills/bmad-loop-sweep/deferred-work-format.md | cat -vetRepository: bmad-code-org/bmad-loop Length of output: 1614 State the tie-break for repeated archive blocks. When multiple archive blocks match the same 🧰 Tools🪛 LanguageTool[uncategorized] ~38-~38: If this is a compound adjective that modifies the following noun, use a hyphen. (EN_COMPOUND_ADJECTIVE_INTERNAL) 🤖 Prompt for AI Agents |
||
|
|
||
| If the invocation carries `--feedback <path>`, read that file FIRST — it lists | ||
| the deterministic validation errors your previous attempt's result.json failed | ||
| on. Fix exactly those defects in this attempt's output. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.