aboutsummaryrefslogtreecommitdiff
path: root/scripts/tests/before-close-queue.bats
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-19 21:10:34 -0500
committerCraig Jennings <c@cjennings.net>2026-07-19 21:10:34 -0500
commit8fd9e39a1ebf6c6513c77dbc6e70eeee85f9ccb8 (patch)
tree5b8445281cad94a97cc3b018771ec79911e24217 /scripts/tests/before-close-queue.bats
parent94e54f69453dea0feda4722347ba3c60c9822c2b (diff)
downloadrulesets-8fd9e39a1ebf6c6513c77dbc6e70eeee85f9ccb8.tar.gz
rulesets-8fd9e39a1ebf6c6513c77dbc6e70eeee85f9ccb8.zip
feat(protocols): add the "the list" before-close queue and colloquialisms convention
Home proposed two linked cross-project norms and Craig approved rolling them out. Both now ship in the template so every project inherits them. A new "Colloquialisms and Expansions" section in protocols.org maps Craig's shorthand to a defined action the agent applies without asking. Two seed entries: "put X on the list" appends to a session-scoped Before-Close Queue, and "tell <project> <message>" drops the message in that project's inbox via inbox-send. The set is extensible. The queue lives under a "* Before-Close Queue" heading in the session anchor, so it resets when the anchor is archived at wrap. Anything that must outlive the session stays a todo.org task. wrap-it-up Step 1 gets a sub-step that works the queue oldest-first before the Summary, so any resulting edits ride the wrap commit, with unfinished items surfaced in the valediction rather than dropped. I settled three design calls. The reference lives in protocols.org rather than a per-project notes.org (home's local reference), since a synced section is what makes it a shared norm. The queue lives in the session anchor, as home did. The wrap step sits at the front of Step 1 rather than a new half-step, which keeps the "Steps 1 through 5" framing intact. A documentation-integrity bats guards the wiring and the before-the-Summary ordering against a future edit or sync dropping it.
Diffstat (limited to 'scripts/tests/before-close-queue.bats')
-rw-r--r--scripts/tests/before-close-queue.bats44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/tests/before-close-queue.bats b/scripts/tests/before-close-queue.bats
new file mode 100644
index 0000000..9c968f7
--- /dev/null
+++ b/scripts/tests/before-close-queue.bats
@@ -0,0 +1,44 @@
+#!/usr/bin/env bats
+# The "Colloquialisms and Expansions" convention and its "the list" before-close
+# queue must stay wired into the synced template: the protocols.org reference
+# section, and the wrap-it-up.org Step 1 sub-step that drains the queue before
+# the Summary. Guards against either being dropped in a future edit or sync.
+
+setup() {
+ REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+ PROTO="$REPO_ROOT/claude-templates/.ai/protocols.org"
+ WRAP="$REPO_ROOT/claude-templates/.ai/workflows/wrap-it-up.org"
+ PROTO_MIRROR="$REPO_ROOT/.ai/protocols.org"
+ WRAP_MIRROR="$REPO_ROOT/.ai/workflows/wrap-it-up.org"
+}
+
+@test "protocols.org documents the Colloquialisms and Expansions convention" {
+ grep -qF '* Colloquialisms and Expansions' "$PROTO"
+ grep -q 'the list' "$PROTO"
+ grep -q 'Before-Close Queue' "$PROTO"
+ grep -qF 'tell <project>' "$PROTO"
+ grep -q 'inbox-send' "$PROTO"
+}
+
+@test "the colloquialisms reference scopes the queue to the session anchor" {
+ grep -q 'session-context.org' "$PROTO"
+ # A must-outlive item is a todo.org task, not a list item.
+ grep -q 'must outlive the session' "$PROTO"
+}
+
+@test "wrap-it-up Step 1 works the Before-Close Queue before the Summary" {
+ grep -qF 'Work the Before-Close Queue' "$WRAP"
+ grep -q 'oldest-first' "$WRAP"
+ grep -q 'silent no-op' "$WRAP"
+ # The queue must be worked before the Summary is written, so its edits ride
+ # this wrap's commit. Assert it sits ahead of the first Summary sub-step.
+ local queue_line kb_line
+ queue_line=$(grep -n 'Work the Before-Close Queue' "$WRAP" | head -1 | cut -d: -f1)
+ kb_line=$(grep -n 'Early KB reflection' "$WRAP" | head -1 | cut -d: -f1)
+ [ "$queue_line" -lt "$kb_line" ]
+}
+
+@test "the convention is mirrored to the committed .ai copy" {
+ diff -q "$PROTO" "$PROTO_MIRROR"
+ diff -q "$WRAP" "$WRAP_MIRROR"
+}