Skip to content

Commit 950fd04

Browse files
Merge pull request #16 from NetDevAutomate/fix/red-ci-tests
Red CI fixed, wind-down decision layer, and the ruled 0.2.1 work
2 parents 1f0b731 + 55d2b52 commit 950fd04

55 files changed

Lines changed: 3146 additions & 212 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/settings.json‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"hooks": {
3+
"PreToolUse": [
4+
{
5+
"matcher": "Bash",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "uv run python scripts/openspec-gate.py pre-tool-use",
10+
"timeout": 30
11+
}
12+
]
13+
}
14+
],
15+
"UserPromptSubmit": [
16+
{
17+
"hooks": [
18+
{
19+
"type": "command",
20+
"command": "uv run python scripts/openspec-gate.py remind",
21+
"timeout": 30
22+
}
23+
]
24+
}
25+
]
26+
}
27+
}

‎.codex/hooks.json‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"hooks": {
3+
"PreToolUse": [
4+
{
5+
"hooks": [
6+
{
7+
"type": "command",
8+
"command": "uv run python scripts/openspec-gate.py pre-tool-use",
9+
"timeout": 30
10+
}
11+
]
12+
}
13+
],
14+
"UserPromptSubmit": [
15+
{
16+
"hooks": [
17+
{
18+
"type": "command",
19+
"command": "uv run python scripts/openspec-gate.py remind",
20+
"timeout": 30
21+
}
22+
]
23+
}
24+
]
25+
}
26+
}

‎.kiro/hooks/openspec-gate.json‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "v1",
3+
"hooks": [
4+
{
5+
"name": "openspec-gate (early warning, not enforcement)",
6+
"trigger": "PreToolUse",
7+
"matcher": "execute_bash",
8+
"action": {
9+
"type": "command",
10+
"command": "uv run python scripts/openspec-gate.py pre-tool-use"
11+
}
12+
},
13+
{
14+
"name": "openspec-remind",
15+
"trigger": "UserPromptSubmit",
16+
"action": {
17+
"type": "command",
18+
"command": "uv run python scripts/openspec-gate.py remind"
19+
}
20+
}
21+
]
22+
}

‎CHANGELOG.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,60 @@ experience may change before `1.0.0`.
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- `studyloop plan record <plan-id> --title <title> [--body … | --body-file …]`
13+
appends a learning record to a plan document, with a matching MCP tool
14+
(`record_plan_learning`) so a mentor can record what was learned at
15+
wind-down. Before this, a learning record existed only if you typed it into
16+
the plan by hand — and an xTiles wind-down's record lived only in xTiles.
17+
The write goes through the plan renderer (never appended as raw text),
18+
numbering continues from the highest existing record, and re-running with
19+
the same title and body changes nothing. The xTiles wind-down now records
20+
into the plan first, so the xTiles page is a projection of a record the plan
21+
already has. ADR-0010 was amended to state the rule the code obeys:
22+
`studyloop plan …` is the plan document's only writer.
23+
- `studyloop brain wind-down --json [--connector NAME]...` answers the one
24+
question the end-of-session protocol needs: which second-brain offer to make,
25+
if any. It returns the channel, whether to offer, the exact sentence to say,
26+
and why — so an agent no longer derives the decision from flags, and the
27+
offer sentence cannot drift between the CLI, the protocol, the skill and the
28+
guide (they are pinned byte-identical by tests).
29+
30+
### Changed
31+
32+
- The xTiles guidance now matches what a person actually saw running the three
33+
prompts end to end (Kiro CLI 2.21.0, 2026-09-04). The planner prompt creates a
34+
planner tile and reports its URL — the one shape the live UI check validates.
35+
The project prompt no longer promises a Kanban board or refreshing collection
36+
pages: the connector cannot create board views and refuses to patch collection
37+
pages on any tier. The wind-down prompt now says to skip the Review task when
38+
`get_due_cards` returns nothing due, rather than inventing a date. The guide
39+
also now says that the next action and due reviews sent to xTiles reflect your
40+
whole study history (they are not plan-scoped), that per-write permission
41+
prompts are xTiles' statement about its connector and what you see depends on
42+
your assistant, that the xTiles learning record is not written back into the
43+
plan document, and that planner tiles can be removed through the connector
44+
while pages and projects must be deleted in the xTiles interface by hand.
45+
- `studyloop install agents` no longer links the xTiles wind-down skill into
46+
`~/.config/opencode/skills`: OpenCode already lists the shared skills hub as a
47+
global search path, so the extra link risked a duplicate listing.
48+
49+
### Fixed
50+
51+
- The Obsidian publisher closed three review residuals: containment is now
52+
checked before any directory is created (a hostile ancestor symlink can no
53+
longer cause directories outside the vault) and once more immediately before
54+
the atomic replace; `--dry-run` now says "would replace your edits in …" —
55+
with the same warning a real publish prints — instead of a plain "would
56+
write"; and a note whose permissions cannot be read is refused rather than
57+
silently rewritten with default permissions.
58+
- `get_study_history` (the MCP tool) and `studyloop plan evaluate` no longer
59+
fail when searching session history: the full-text query joined two tables
60+
that both carry a `content` column without qualifying it, and OR'd multiple
61+
`MATCH` constraints, which FTS5 refuses. Multi-word topics such as
62+
"window functions" now also match as phrases rather than scattered terms.
63+
1064
## [0.2.0] - 2026-09-04
1165

1266
### Added

‎Justfile‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,31 @@ smoke-extras:
148148
build-release:
149149
./scripts/build-release.sh
150150

151+
# WD-5/WD-6: the live wind-down gate checks, captured through Claude Code
152+
# headless against the LiteLLM gateway (no vendor credential; the key is read
153+
# from the proxy's own config at runtime). Opt-in — burns gateway spend
154+
# (estimate: reviews/2026-09-04-gate-checks/ESTIMATE.md). Writes transcripts
155+
# and the pass/fail summary under reviews/…/evidence/gate-checks/.
156+
gate-checks:
157+
STUDYLOOP_EVIDENCE_DIR={{justfile_directory()}}/reviews/2026-09-04-gate-checks/evidence/gate-checks \
158+
uv run --group dev pytest packages/studyloop/tests/live/test_wind_down_transcripts.py -m live_provider -q
159+
151160
release-consistency:
152161
uv run python scripts/check-release-consistency.py --skip-wheel
153162

163+
# The release-mode superset: everything above PLUS the openspec guards — a
164+
# change with commits since the last tag must be archived or carry a
165+
# `deferred: <reason>`, and archive entries ADDED since the last tag must pass
166+
# `openspec validate` (soft-skipped when the CLI is absent, same convention as
167+
# spec-check; not `--archived --all`, because a July archive predating this
168+
# guard has unticked tasks nobody has evidence to reconcile, and re-failing
169+
# every future release on it would teach people to ignore the gate).
170+
# Deliberately NOT part of preflight: open changes are legal during a cycle;
171+
# only shipping one is not. Both guards would have fired on the 0.2.0 cut
172+
# (2026-09-04 review, Q5).
173+
release-consistency-shipped:
174+
uv run python scripts/check-release-consistency.py --skip-wheel --release
175+
154176
prepare-release version:
155177
uv run python scripts/prepare-release.py {{version}}
156178

@@ -193,7 +215,7 @@ xtiles-auth:
193215

194216
preflight: lint typecheck test test-js docs release-consistency spec-check
195217

196-
release-check: test test-js lint typecheck shellcheck docs audit audit-full release-consistency smoke-installed smoke-extras
218+
release-check: test test-js lint typecheck shellcheck docs audit audit-full release-consistency-shipped smoke-installed smoke-extras
197219

198220
# "Would GitHub Actions pass?" locally, before pushing. `check` runs the
199221
# host-answerable gates (lint, typecheck, test, sast, audit, docs, ...); `lint`

‎agents/manifest.json‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,63 @@
33
"agents": {
44
"claude/socratic-mentor.md": {
55
"hash": "42880ffa80484ec9",
6-
"updated": "2026-09-03"
6+
"updated": "2026-09-04"
77
},
88
"codex/AGENTS.md": {
99
"hash": "23dc3d4fbdea89c3",
10-
"updated": "2026-09-03"
10+
"updated": "2026-09-04"
1111
},
1212
"kiro/study-mentor.json": {
1313
"hash": "c9f2302ebc8d3c39",
14-
"updated": "2026-09-03"
14+
"updated": "2026-09-04"
1515
},
1616
"opencode/study-mentor.md": {
1717
"hash": "0ff72c058de9f7d2",
18-
"updated": "2026-09-03"
18+
"updated": "2026-09-04"
1919
},
2020
"pi/AGENTS.md": {
2121
"hash": "8706855f619c71b5",
22-
"updated": "2026-09-03"
22+
"updated": "2026-09-04"
2323
},
2424
"shared/audhd-framework.md": {
2525
"hash": "8b694064b100741f",
26-
"updated": "2026-09-03"
26+
"updated": "2026-09-04"
2727
},
2828
"shared/break-science.md": {
2929
"hash": "74541a44431f7f6a",
30-
"updated": "2026-09-03"
30+
"updated": "2026-09-04"
3131
},
3232
"shared/knowledge-bridging.md": {
3333
"hash": "adb4221cda83498f",
34-
"updated": "2026-09-03"
34+
"updated": "2026-09-04"
3535
},
3636
"shared/network-bridges.md": {
3737
"hash": "8af4732b77cc15ae",
38-
"updated": "2026-09-03"
38+
"updated": "2026-09-04"
3939
},
4040
"shared/session-protocol.md": {
4141
"hash": "b58178df20cb9008",
42-
"updated": "2026-09-03"
42+
"updated": "2026-09-04"
4343
},
4444
"shared/socratic-engine.md": {
4545
"hash": "42738fba9479ec14",
46-
"updated": "2026-09-03"
46+
"updated": "2026-09-04"
4747
},
4848
"shared/teach-back-protocol.md": {
4949
"hash": "9bbe8831f1c74837",
50-
"updated": "2026-09-03"
50+
"updated": "2026-09-04"
5151
},
5252
"shared/wind-down-protocol.md": {
53-
"hash": "d9d0dde390e03b4c",
54-
"updated": "2026-09-03"
53+
"hash": "5b1ec3303b8d1086",
54+
"updated": "2026-09-04"
5555
},
5656
"skills/studyloop-xtiles-wind-down/SKILL.md": {
57-
"hash": "aa31c59092ffe929",
58-
"updated": "2026-09-03"
57+
"hash": "a2e84febb865f24d",
58+
"updated": "2026-09-04"
5959
},
6060
"skills/studyloop-xtiles-wind-down/references/harnesses.md": {
61-
"hash": "e3f0ebc00ee792a8",
62-
"updated": "2026-09-03"
61+
"hash": "d2beeed44e1c0154",
62+
"updated": "2026-09-04"
6363
}
6464
}
6565
}

‎agents/shared/wind-down-protocol.md‎

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,29 @@ Standard end-of-session tasks from session-protocol.md:
4848

4949
4. Set next review dates via spaced repetition schedule.
5050

51-
5. Offer the second brain — **only if one is configured, and only once**:
51+
5. Offer the second brain — **only if the decision command says to, and only
52+
once**. Run this step silently: never announce, name or narrate it in any
53+
state — the learner hears either the offer sentence or nothing at all.
5254

5355
```bash
54-
studyloop brain status --json
56+
studyloop brain wind-down --json --connector <name>
5557
```
5658

57-
If **both** `configured` and `supports_publish` are `true`, offer exactly once,
58-
in one sentence:
59+
```bash
60+
studyloop brain wind-down --json
61+
```
62+
63+
That is the whole command when no MCP tools are visible to you. Add
64+
`--connector <server>` for each MCP server whose tools you can actually
65+
see in this session — MCP tools are named `mcp__<server>__…`, so the
66+
server name is read off the tools themselves, and only `xtiles` affects
67+
the decision. The flag is a statement of fact about this session, not part
68+
of the command's syntax: **naming a connector whose tools you cannot see
69+
fabricates an offer for a service the session cannot reach.** The command
70+
answers with `channel`, `offer`, `sentence` and `reason`.
71+
72+
If `offer` is `true`, say `sentence` **verbatim, exactly once**. For the
73+
`publish` channel that sentence is:
5974

6075
<!-- wind-down-offer -->
6176
Want me to publish today's study record and this plan to your Obsidian vault (Study/Today.md and Study/Plans/<plan-id>.md)? Yes or no — I'll only ask once.
@@ -67,13 +82,23 @@ Standard end-of-session tasks from session-protocol.md:
6782
studyloop brain publish --today --plan <plan-id>
6883
```
6984

70-
On **no**, or in any other case, **say nothing about second brains at all** and
71-
continue the wind-down. Do not repeat the offer later in the session.
72-
73-
Both flags are required, not just `configured`. A learner on xTiles *is*
74-
configured but has no programmatic backend (`supports_publish: false`), so
75-
offering the publish command would name something that cannot work — and would
76-
do it at the end of every session.
85+
For the `xtiles` channel, follow the `studyloop-xtiles-wind-down` skill,
86+
which carries its own pinned sentence.
87+
88+
If `offer` is `false`, or on **no**, **say nothing about second brains at
89+
all** and continue the wind-down. Do not repeat the offer later in the
90+
session. "No second brain is configured, so nothing to offer", "running
91+
the second brain check now", and "the learner declined, so no xTiles
92+
write happens" are all violations, not courtesies — a declined offer is
93+
acknowledged by moving on, never by naming what was declined.
94+
95+
The command computes two separate rules — not one conjunction. `configured`
96+
plus `supports_publish` (both from `studyloop brain status --json`) selects
97+
the publish offer; provider `xtiles` plus a connected `xtiles` connector
98+
selects the skill's offer. A learner on xTiles *is* configured but has no
99+
programmatic backend (`supports_publish: false`), so the publish sentence
100+
would name something that cannot work — which is why the decision lives in
101+
the command rather than in this prose.
77102

78103
### Phase 2: Consolidation Guidance (spoken if voice mode is active)
79104

‎agents/skills/studyloop-xtiles-wind-down/SKILL.md‎

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,53 @@ you, not a feature of the CLI.
1717
Use only during Phase 1 of `~/.agents/shared/wind-down-protocol.md`, after progress
1818
has been recorded with `studyloop progress "<concept>" -t <topic> -c <confidence>`.
1919

20-
## Gate — both halves, checked every session
20+
## Gate — decided by the CLI, checked every session
21+
22+
Run the decision command, naming each MCP server connected in this session:
23+
24+
```bash
25+
studyloop brain wind-down --json --connector xtiles
26+
```
27+
28+
Offer only when it answers `"channel": "xtiles"` with `"offer": true`. That
29+
happens exactly when both halves of the gate hold:
2130

2231
1. `studyloop brain status --json` reports `provider: xtiles`. Any other provider
2332
means this file does not apply: an Obsidian learner has already been offered the
2433
publish command in Phase 1, and a learner on `none` has chosen neither.
2534
2. An MCP server named `xtiles` is connected in this session — its tools are
26-
visible to you. If it is not, do nothing and say nothing about xTiles. Do not
27-
suggest they connect one; an offer to set up a service they never asked for is
28-
the thing this gate exists to prevent.
35+
visible to you, and you passed `--connector xtiles` to say so. If it is not,
36+
do nothing and say nothing about xTiles. Do not suggest they connect one; an
37+
offer to set up a service they never asked for is the thing this gate exists
38+
to prevent.
2939

30-
If either half is false, continue the wind-down without mentioning xTiles at all.
40+
If `offer` is false, continue the wind-down without mentioning xTiles at all.
3141

3242
## The offer
3343

34-
Offer once, in one line:
44+
Offer once, in one line — the `sentence` the command returned, verbatim:
3545

46+
<!-- xtiles-wind-down-offer -->
3647
> Want me to add today's learning record and the next review to your xTiles project? Yes or no — I'll only ask once.
48+
<!-- /xtiles-wind-down-offer -->
3749
38-
On **yes**, follow prompt P3 from the Second Brain guide: one learning-record page
39-
under the plan's project, one dated planner task for the next review, then say what
40-
you wrote. Ask before each write, and if xTiles refuses a write, report what it
41-
said rather than retrying.
50+
On **yes**, record into the plan **first**: `studyloop plan record <plan-id>
51+
--title "<topic>" --body "<the summary>"` (or the `record_plan_learning` MCP
52+
tool). The plan document is the source of truth, and the xTiles page must be a
53+
projection of a record it already has — never the only copy. Then follow prompt
54+
P3 from the Second Brain guide: one learning-record page under the plan's
55+
project, one dated planner task for the next review, then say what you wrote.
56+
Ask before each write, and if xTiles refuses a write, report what it said
57+
rather than retrying.
4258

4359
On **no**, continue the wind-down and do not raise it again this session.
4460

4561
## What this sends, and where
4662

4763
The summary, the plan title and the next review date go to the model service
48-
backing this session and, through the connector, to xTiles' cloud. xTiles asks
64+
backing this session and, through the connector, to xTiles' cloud. The due
65+
reviews come from the learner's whole study state, not one plan's — nothing in
66+
these tools is plan-scoped. xTiles asks
4967
permission per request, and your assistant reaches only what the learner's own
5068
xTiles account can already see — nothing is shared with other users. StudyLoop
5169
stores no xTiles credential and keeps no copy of what was written: the sign-in

0 commit comments

Comments
 (0)