@antoneeo/kb-agentic-skill 1.36.0 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  Every significant change to this skill is recorded here.
4
4
 
5
5
 
6
+ ## [1.37.0] - 2026-11-12
7
+
8
+ ### What's new
9
+
10
+ **A guide that governs the work is now read whole before the agent edits.** Agents often read only the first part of a matching guide (a read with a line limit, `head`, a search inside it) and then applied only that part, missing the steps further down. The doctrine now says a matched guide is read from its first line to its last and applied whole; a rule that does not fit is proposed as a change to the guide, never skipped in silence, and the rest still binds. The per-prompt reminder says the same. On Claude Code, and on local Codex sessions where you trusted the installed hooks, the edit check enforces it: an edit is refused until the session's reads of every guide named in its router verdict cover the whole file. A search, `head`, `sed`, a partial read or a subagent brief that names the guide no longer counts as reading it (F-094).
11
+
12
+ #### What to do
13
+
14
+ Everyone who has this package installed: run `npm install -g @antoneeo/kb-agentic-skill@latest`, then `kb-agentic-install-skill`, and restart your agent sessions. The install step copies the updated doctrine and validator into your skills directory; sessions already open keep the old check until restarted. Expect one new refusal: if a session only searched or partly read a guide it named in its router verdict, its first edit is refused and the message names the guide. Read the guide whole, with no offset or limit (a guide longer than your client's read cap in consecutive chunks to the end), then edit again. To check it worked, run `npm ls -g @antoneeo/kb-agentic-skill` and look for 1.37.0.
15
+
6
16
  ## [1.36.0] - 2026-11-08
7
17
 
8
18
  ### What's new
package/README.md CHANGED
@@ -6,13 +6,13 @@ The sibling of [`@antoneeo/agentic-sdlc-skill`](https://www.npmjs.com/package/@a
6
6
 
7
7
  <!-- whats-new:begin -->
8
8
  <!-- generated by scripts/whats_new.js from distributions/kb-agentic-skill/CHANGELOG.md: edit the CHANGELOG, then run node scripts/whats_new.js --write -->
9
- ## What's new in 1.36.0
9
+ ## What's new in 1.37.0
10
10
 
11
- **With several lenses of the family installed, the per-prompt reminder now names them.** A machine gets one reminder for the whole family, wired by whichever lens was installed first, so a knowledge or marketing task used to see the code lens's line. When other lenses are installed, the line now lists each one with its domain, for example `kb-agentic (knowledge)`, and asks the agent to load the one that governs the work. A single-lens install sees no change. To do this the reminder reads the installed skill names at each prompt (names only), and its length bound rises from 600 to 700 characters (F-093).
11
+ **A guide that governs the work is now read whole before the agent edits.** Agents often read only the first part of a matching guide (a read with a line limit, `head`, a search inside it) and then applied only that part, missing the steps further down. The doctrine now says a matched guide is read from its first line to its last and applied whole; a rule that does not fit is proposed as a change to the guide, never skipped in silence, and the rest still binds. The per-prompt reminder says the same. On Claude Code, and on local Codex sessions where you trusted the installed hooks, the edit check enforces it: an edit is refused until the session's reads of every guide named in its router verdict cover the whole file. A search, `head`, `sed`, a partial read or a subagent brief that names the guide no longer counts as reading it (F-094).
12
12
 
13
13
  #### What to do
14
14
 
15
- Everyone who has this package installed: run `npm install -g @antoneeo/kb-agentic-skill@latest`, then `kb-agentic-install-skill`, and restart your agent sessions. The install step copies the updated validator into your skills directory and wires the reminder if it is missing; sessions already open keep the old one until restarted. To check it worked, run `npm ls -g @antoneeo/kb-agentic-skill` and look for 1.36.0, then start a session: on a machine with more than one lens of the family installed, the one-line reminder shown at each prompt names the installed lenses with their domains.
15
+ Everyone who has this package installed: run `npm install -g @antoneeo/kb-agentic-skill@latest`, then `kb-agentic-install-skill`, and restart your agent sessions. The install step copies the updated doctrine and validator into your skills directory; sessions already open keep the old check until restarted. Expect one new refusal: if a session only searched or partly read a guide it named in its router verdict, its first edit is refused and the message names the guide. Read the guide whole, with no offset or limit (a guide longer than your client's read cap in consecutive chunks to the end), then edit again. To check it worked, run `npm ls -g @antoneeo/kb-agentic-skill` and look for 1.37.0.
16
16
 
17
17
  Full history: [CHANGELOG](https://github.com/Antoneeo/agentic-sdlc-skill/blob/main/distributions/kb-agentic-skill/CHANGELOG.md)
18
18
  <!-- whats-new:end -->
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kb-agentic-skill",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "description": "Knowledge-Base & Document-First protocol with risk triage, Vision governance, signal distillation and optional devPNT integration.",
5
5
  "author": "Antonio Pinto (https://github.com/Antoneeo)"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antoneeo/kb-agentic-skill",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "description": "Knowledge-Base & Document-First protocol for Claude Code, Gemini CLI, Google Antigravity and Codex with risk triage, Vision governance, signal distillation and optional devPNT integration.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -108,7 +108,7 @@ Semantics: exit code 2 + message on stderr ⇒ the write is blocked and the mess
108
108
 
109
109
  `sdlc_check.py verdict --hook` refuses an Edit, Write, MultiEdit or NotebookEdit when the
110
110
  session transcript shows no guide-router verdict (a line that opens with `router: …` or with the level, `Level: L2 · router: …`, `Level: Spike · router: …`; or one that opens with a level-1 declaration)
111
- or a guide the verdict names was never read; it is silent in projects without guides and
111
+ or a guide the verdict names was not read WHOLE: the session's reads of it (Read spans, a literal `cat`/`Get-Content`, `get_file_content`) must cover its first to its last line; Grep, `head`, `sed` or a brief naming it read nothing (F-094); it is silent in projects without guides and
112
112
  whenever it cannot tell. The code package (`agentic-sdlc`) wires it machine-wide on
113
113
  Claude Code; this package does not. To wire it by hand, add a `PreToolUse` entry with
114
114
  matcher `Edit|Write|MultiEdit|NotebookEdit` and command
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kb-agentic
3
- version: 1.36.0
3
+ version: 1.37.0
4
4
  description: Knowledge-Base & Document-First protocol with risk-proportional triage, Vision as a guide, Signal Distillation, a complete Standalone mode and optional symbiosis with devPNT. Use for user documentation, knowledge extraction, SOPs, research notes, decision logs, knowledge management — and for answering project questions from the claim ledger and topic graph.
5
5
  author: Antonio Pinto (https://github.com/Antoneeo)
6
6
  copyright: (c) 2026 Antonio Pinto
@@ -147,7 +147,7 @@ Use this mode when `devpnt_*` tools are available and point at the current proje
147
147
 
148
148
  ### 4. Knowledge Processing & Distillation
149
149
  - **Isolate the work (Branch/worktree hygiene).** Distillation rewrites existing notes — full re-read per `## Revision` — and does it on a branch or a worktree, never directly on the shared corpus, so a half-finished reconciliation is never what the next reader finds. Where a project does not isolate (one shared checkout), that is a departure from this rule, not a second mode: Rule Zero's step save commit and its declared residual apply. A session that may run while another session uses the same checkout works in its **own git worktree**, and never switches branch, stashes, resets or runs `index` in a checkout another session may be using. Parallel work also shares ids: choose a new unit's id **after fetching**, as the first id free on every branch and tag the checkout can see (`check` names a collision while the unit is open).
150
- - Before drafting (L2/L3; L1 exempt), **consult the guide router** for a guide covering the task and read it first (the consult trigger, `guides.md` §0). A targeted description match, not a blanket read. Its result is the router verdict already declared with the triage level (Rule Zero).
150
+ - Before drafting (L2/L3; L1 exempt), **consult the guide router** for a guide covering the task and read the match WHOLE first — every line, no offset or limit, no excerpt; past the client's read cap, in chunks to the end — and apply it WHOLE: a rule that does not fit is proposed as an amendment to the guide, never skipped in silence, and the rest still binds. The match is targeted (which guide), never partial (which lines) (the consult trigger, `guides.md` §0), not a blanket read. Its result is the router verdict already declared with the triage level (Rule Zero).
151
151
  - Execute knowledge extraction using **Signal Distillation** (`distillation.md`).
152
152
  - **Opt-in subagent execution**: for an L3 with an approved analysis, the work MAY be executed via subagents per `dispatch.md`; default stays same-session. `dispatch.md` also carries the family-wide **delegation boundary** (what may be delegated at all, and what never may) — that section is not gated by the opt-in trigger and applies at any level, dispatch or no dispatch.
153
153
  - Handle conflicting or outdated information via **Reconciliation** (`reconciliation.md`). Mark obsolete files `status: SUPERSEDED`.
@@ -169,7 +169,7 @@ Use this mode when `devpnt_*` tools are available and point at the current proje
169
169
 
170
170
  ## Operative Guides & Router
171
171
  Guides are consulted, created, and distilled per `guides.md`.
172
- - **Consult (before acting)**: check `ai_docs/reference/INDEX.md` — the guide router — and declare the verdict with the triage level.
172
+ - **Consult (before acting)**: check `ai_docs/reference/INDEX.md` — the guide router — and declare the verdict with the triage level; a matched guide is read whole and applied whole (`guides.md` §0).
173
173
  - **Propose proactively**: when the user hands over indications that will govern future work, propose distilling them into a guide. A proposal, never a silent write, and never from model knowledge — a guide's whole value is that every claim traces to what the user actually provided.
174
174
  - Distill from user instructions into `ai_docs/reference/GUIDE_[topic].md`.
175
175
 
@@ -41,8 +41,8 @@ without an E-ISP.
41
41
  consult trigger (`guides.md` §0) applied at plan-authoring time: the orchestrator
42
42
  runs the router lookup (project router `ai_docs/reference/INDEX.md` + the agent-KB
43
43
  router) when populating `guides`. A dispatched context-free subagent does **NOT**
44
- run its own router consult — it reads the guide pointers handed to it in the
45
- brief. The router verdict (Rule Zero) is therefore declared ONCE, by the
44
+ run its own router consult — it reads each guide handed to it in the brief
45
+ whole, every line, and applies it whole (`guides.md` §0). The router verdict (Rule Zero) is therefore declared ONCE, by the
46
46
  orchestrator, when it authors the plan; a dispatched subagent does not declare
47
47
  one. (Proactive guide-creation stays at closure — the same broad final pass
48
48
  below — so it needs no separate dispatch hook.)
@@ -34,12 +34,28 @@ already cover how to do this well?*
34
34
  - **Scan the router, not the guides.** Read the when-to-consult descriptions in
35
35
  the guide router `ai_docs/reference/INDEX.md` **and** the agent-KB router
36
36
  `~/.agentic-sdlc/ai_docs/reference/INDEX.md` (if present). Match by topic.
37
- - **On a match, read that guide's synthesis whole** before acting (the snapshot
38
- stays on demand via the section markers). No match → proceed normally.
39
- - **Targeted match, never blanket.** Open only the guide whose description fits
40
- the task — never load every guide, which would reintroduce the exact token
41
- cost the "point to them" model exists to avoid. The two-level model (compact
42
- synthesis / verbatim snapshot) already bounds a single guide's cost.
37
+ - **On a match, read the WHOLE guide before acting — every line, first to
38
+ last.** No offset that skips its start, no limit that stops before its end, no
39
+ `head`/`sed`/grep excerpt, no "the section that looks relevant". Where the
40
+ client caps one read (Claude Code's Read stops at 2000 lines), continue in
41
+ consecutive chunks until the last line. Only the snapshot (the book) is read
42
+ on demand, through the section markers. No match → proceed normally.
43
+ - **Apply the WHOLE guide.** Every rule it states binds the work it matched, not
44
+ the subset you recognized. A rule you judge wrong, outdated or inapplicable is
45
+ never skipped in silence: name it, say why, and propose amending the guide
46
+ (§6); until the amendment is accepted, the guide as written governs, and any
47
+ deviation you take is declared to the user with its reason. Even then the
48
+ guide is considered whole: the other rules still bind. Why: an agent that
49
+ reads part of a guide applies part of it, and the omitted rule is exactly the
50
+ one the guide was written to carry (F-094 field scan: 157 partial reads of
51
+ guides against 118 whole ones; a release ran on 130 of the 225 lines of its
52
+ runbook).
53
+ - **Targeted match, never blanket.** "Targeted" chooses WHICH guide, never which
54
+ part of it: open only the guide whose description fits the task — never load
55
+ every guide, which would reintroduce the exact token cost the "point to them"
56
+ model exists to avoid. The two-level model (compact synthesis / verbatim
57
+ snapshot) already bounds a single guide's cost, so a whole read is affordable
58
+ by construction.
43
59
  - **Declare the router verdict.** The lookup result travels with the triage
44
60
  level (`SKILL.md` Rule Zero) as one line — `router: no match`, or
45
61
  `router: GUIDE_x.md → read`. This is what makes the consult reliable: an
@@ -66,7 +82,8 @@ already cover how to do this well?*
66
82
  unit of work.
67
83
  - **Under subagent dispatch** the consult happens at plan-authoring time (the
68
84
  orchestrator populates each task's `guides` field); a context-free subagent
69
- reads the pointers it was handed and does not run its own router lookup. See
85
+ reads each guide it was handed whole, as above, and does not run its own
86
+ router lookup. See
70
87
  `dispatch.md`.
71
88
 
72
89
  ## 1. When to trigger
@@ -232,8 +249,9 @@ the component from partial understanding.
232
249
  comprehension repertoire — how it works / control & data flow / invariants / where
233
250
  it breaks), each with a fidelity marker.
234
251
  **Write for the two-level read**: the guide (synthesis) is small enough to
235
- be read WHOLE before acting; the snapshot (book) is where size lives and
236
- where readers grep/partial-read on demand, following the section markers.
252
+ be read WHOLE before acting, and every reader reads it whole (§0); the
253
+ snapshot (book) is where size lives and the only place readers grep or
254
+ partial-read on demand, following the section markers.
237
255
  Use the repertoire's stable, self-describing headings, keep one concern per
238
256
  `##` section, and make the frontmatter `description` the "should I open
239
257
  this file at all" answer. This is why one synthesis + one book beats
@@ -287,6 +305,12 @@ state it explicitly when handing off a newly created guide.
287
305
 
288
306
  ## 6. Maintenance
289
307
 
308
+ - **A rule that does not fit the work is a proposed amendment, never a silent
309
+ skip** (§0). Read the whole guide, name the rule and the reason, and propose
310
+ the change through this pipeline — a `document` guide changes only with the
311
+ user's confirmation and a new snapshot of the source that changed; a `code`
312
+ guide is corrected against the code. Until the amendment lands, the guide as
313
+ written governs, and every other rule in it still binds.
290
314
  - **Source changed**: new snapshot, regenerate the guide from it (new
291
315
  `source_hash`); a guide REPLACING another is `status: SUPERSEDED` on the old
292
316
  one. `sdlc_check.py stale` (also under `--hybrid`) reports `[stale]` when a
@@ -44,7 +44,8 @@ sdlc_core.set_profile(
44
44
  remind_line=(
45
45
  "first decide if this skill governs the work; if yes, LOAD it once -- an "
46
46
  "unread protocol cannot be applied. Triage: L1 quick fact, L2 propagation, "
47
- "L3 new knowledge unit, Spike; declare the level. On this project's "
47
+ "L3 new knowledge unit, Spike; declare the level. A matched guide is read "
48
+ "whole and applied whole. On this project's "
48
49
  "domain, read topics/INDEX.md first and cite claim ids, or state no "
49
50
  "coverage. Decisions today get recorded in the KB at close. Revising a "
50
51
  "document? Re-read it whole and rewrite to current state -- never append "
@@ -2801,8 +2801,21 @@ def cmd_gate(args):
2801
2801
  # 0) only on certainty; whatever it cannot tell resolves to silence. It never
2802
2802
  # prints `allow` -- that would skip the user's permission prompt. Owner: block
2803
2803
  # (REQUEST_guide_verdict_check.md R3), wired by default (R4, rulings.md r34).
2804
+ #
2805
+ # F-094: a named guide counts as read only when the session read EVERY line of
2806
+ # it. Before, the guide's name anywhere in a non-edit tool's input was a read, so
2807
+ # `Read offset=1 limit=130` of a 225-line guide, `head -30` or a Grep on it all
2808
+ # passed (field scan: 157 partial Reads of guides against 118 whole ones), and
2809
+ # the agent applied the part it had seen. A read is now a line span: a Read call
2810
+ # (offset is the 1-based first line, probed 2026-11-12; no limit = the client's
2811
+ # READ_DEFAULT_LIMIT), a literal shell `cat`/`Get-Content` (whole, or its
2812
+ # -TotalCount), a get_file_content (whole). Grep, head, sed, an Agent prompt
2813
+ # naming the guide: no span. The guide is read when the spans cover 1..its last
2814
+ # line. Owner: REQUEST_whole_guide_read.md R1.
2804
2815
 
2805
2816
  VERDICT_EDIT_TOOLS = ("Edit", "Write", "MultiEdit", "NotebookEdit")
2817
+ READ_DEFAULT_LIMIT = 2000 # Claude Code's Read without `limit` stops at line 2000
2818
+ GUIDE_COUNT_MAX = 8 * 1024 * 1024 # a larger guide: cannot afford to count its lines
2806
2819
  VERDICT_MAX_BYTES = 256 * 1024 * 1024 # a larger transcript: cannot afford to tell
2807
2820
  VERDICT_LINE_MAX = 1024 * 1024 # assistant lines are small; skip the rest unparsed
2808
2821
  # Markdown emphasis between the word and the colon ("**router**: no match") and
@@ -2886,6 +2899,13 @@ def hook_edits(payload):
2886
2899
 
2887
2900
  def shell_read_paths(command, cwd, workdir=None):
2888
2901
  """Literal Get-Content/cat reads only: no shell expansion or execution."""
2902
+ found = shell_read(command, cwd, workdir)
2903
+ return found[0] if found else None
2904
+
2905
+
2906
+ def shell_read(command, cwd, workdir=None):
2907
+ """(paths, line count or None) of a literal Get-Content/cat read, else None.
2908
+ The count is Get-Content's -TotalCount (F-094): those lines only, not the file."""
2889
2909
  if not isinstance(command, str) or re.search(r"[$`\r\n;|&<>\x00]", command):
2890
2910
  return None
2891
2911
  token_re = re.compile(r"\s*(?:'([^']*)'|\"([^\"]*)\"|([^\s'\"]+))")
@@ -2899,7 +2919,7 @@ def shell_read_paths(command, cwd, workdir=None):
2899
2919
  pos = match.end()
2900
2920
  if not tokens or tokens[0].lower() not in ("get-content", "cat"):
2901
2921
  return None
2902
- paths, i = [], 1
2922
+ paths, i, count = [], 1, None
2903
2923
  while i < len(tokens):
2904
2924
  token = tokens[i]
2905
2925
  if tokens[0].lower() == "get-content" and token.lower() in ("-literalpath", "-path", "-raw"):
@@ -2909,6 +2929,7 @@ def shell_read_paths(command, cwd, workdir=None):
2909
2929
  i += 1
2910
2930
  if i == len(tokens) or not tokens[i].isdigit():
2911
2931
  return None
2932
+ count = int(tokens[i])
2912
2933
  elif tokens[0] == "cat" and token == "--":
2913
2934
  pass
2914
2935
  elif token.startswith("-") or re.search(r"[*?\[\],]", token):
@@ -2920,7 +2941,7 @@ def shell_read_paths(command, cwd, workdir=None):
2920
2941
  return None
2921
2942
  paths.append(resolved)
2922
2943
  i += 1
2923
- return paths or None
2944
+ return (paths, count) if paths else None
2924
2945
 
2925
2946
 
2926
2947
  def _codex_literal_calls(code):
@@ -3006,8 +3027,12 @@ def transcript_events(path):
3006
3027
  for edit in hook_edits({"tool_input": {"command": command}, "cwd": cwd}) or []:
3007
3028
  blocks.append({"type": "tool_use", "name": "Write", "input": {"file_path": edit["path"]}})
3008
3029
  for args in calls:
3009
- for target in shell_read_paths(args.get("cmd", args.get("command")), cwd, args.get("workdir")) or []:
3010
- blocks.append({"type": "tool_use", "name": "Read", "input": {"file_path": target}})
3030
+ found = shell_read(args.get("cmd", args.get("command")), cwd, args.get("workdir"))
3031
+ for target in (found[0] if found else []):
3032
+ # F-094: the shell read is whole (no limit) unless -TotalCount
3033
+ inp = {"file_path": target}
3034
+ inp.update({"limit": found[1]} if found[1] is not None else {"whole": True})
3035
+ blocks.append({"type": "tool_use", "name": "Read", "input": inp})
3011
3036
  if blocks:
3012
3037
  yield {"type": "assistant", "isSidechain": bool(entry.get("agent_id") or data.get("agent_id")),
3013
3038
  "message": {"content": blocks}}
@@ -3020,9 +3045,9 @@ def transcript_facts(path):
3020
3045
  Returns {"assistant": entries parsed, "sidechain": a subagent's own transcript
3021
3046
  (Claude Code marks every entry of one `isSidechain`), "declared": a router verdict seen,
3022
3047
  "trivial": a level-1 declaration seen (`Level: L1`, `E1`), "named": guides the verdicts name,
3023
- "read": guide names that appeared in a non-edit tool's input}."""
3048
+ "read": guide name -> the line spans the session read of it (F-094, _read_spans)}."""
3024
3049
  facts = {"assistant": 0, "sidechain": False, "declared": False, "trivial": False,
3025
- "named": set(), "read": set()}
3050
+ "named": set(), "read": {}}
3026
3051
  try:
3027
3052
  p = Path(path)
3028
3053
  if not p.is_file() or p.stat().st_size > VERDICT_MAX_BYTES:
@@ -3049,15 +3074,75 @@ def transcript_facts(path):
3049
3074
  facts["declared"] = True
3050
3075
  if not _VERDICT_NONE_RE.match(m.group(1)):
3051
3076
  facts["named"].update(_GUIDE_NAME_RE.findall(m.group(1)))
3052
- elif (block.get("type") == "tool_use"
3053
- and block.get("name") not in VERDICT_EDIT_TOOLS):
3054
- facts["read"].update(_GUIDE_NAME_RE.findall(
3055
- json.dumps(block.get("input"), ensure_ascii=False)))
3077
+ elif block.get("type") == "tool_use":
3078
+ base = entry.get("cwd") if isinstance(entry.get("cwd"), str) else None
3079
+ for name, span in _read_spans(block, base or str(p.parent)):
3080
+ facts["read"].setdefault(name, []).append(span)
3056
3081
  except (OSError, ValueError, TypeError, AttributeError):
3057
3082
  return None
3058
3083
  return facts
3059
3084
 
3060
3085
 
3086
+ def _read_spans(block, cwd):
3087
+ """(guide name, (first line, last line or None = end of file)) for each guide
3088
+ this tool call read (F-094). Only reads that return the file's lines count; a
3089
+ search, an excerpt command or a prompt naming the guide reads nothing. `cwd`
3090
+ only anchors a relative shell path: the guide is matched by its name."""
3091
+ name, inp = block.get("name"), block.get("input")
3092
+ if not isinstance(inp, dict):
3093
+ return []
3094
+ if name == "Read" and isinstance(inp.get("file_path"), str):
3095
+ if inp.get("whole") is True:
3096
+ span = (1, None)
3097
+ else:
3098
+ offset, limit = inp.get("offset"), inp.get("limit")
3099
+ for v in (offset, limit): # present but not a plain int: cannot tell, no credit
3100
+ if v is not None and (not isinstance(v, int) or isinstance(v, bool)):
3101
+ return []
3102
+ if limit is not None and limit <= 0:
3103
+ return []
3104
+ first = offset if offset is not None and offset > 1 else 1
3105
+ count = limit if limit is not None else READ_DEFAULT_LIMIT
3106
+ span = (first, first + count - 1)
3107
+ return [(g, span) for g in _GUIDE_NAME_RE.findall(Path(inp["file_path"]).name)]
3108
+ if name in ("Bash", "PowerShell"):
3109
+ found = shell_read(inp.get("command"), cwd)
3110
+ if not found:
3111
+ return []
3112
+ span = (1, found[1]) if found[1] is not None else (1, None)
3113
+ return [(g, span) for path in found[0] for g in _GUIDE_NAME_RE.findall(Path(path).name)]
3114
+ if isinstance(name, str) and name.endswith("get_file_content"):
3115
+ paths = inp.get("paths") if isinstance(inp.get("paths"), list) else []
3116
+ return [(g, (1, None)) for path in paths if isinstance(path, str)
3117
+ for g in _GUIDE_NAME_RE.findall(Path(path).name)]
3118
+ return []
3119
+
3120
+
3121
+ def _guide_lines(path):
3122
+ """The guide's line count, or None when it cannot be counted within the bounds."""
3123
+ try:
3124
+ if path.stat().st_size > GUIDE_COUNT_MAX:
3125
+ return None
3126
+ text = path.read_bytes()
3127
+ except OSError:
3128
+ return None
3129
+ return text.count(b"\n") + (0 if not text or text.endswith(b"\n") else 1)
3130
+
3131
+
3132
+ def _read_whole(spans, lines):
3133
+ """True when the spans cover lines 1..lines. Unknown size: any read counts."""
3134
+ if not spans:
3135
+ return False
3136
+ if lines is None:
3137
+ return True
3138
+ reached = 0
3139
+ for first, last in sorted(spans, key=lambda s: s[0]):
3140
+ if first > reached + 1:
3141
+ break
3142
+ reached = max(reached, lines if last is None else last)
3143
+ return reached >= lines
3144
+
3145
+
3061
3146
  def verdict_reason(payload, root=None, docs_name=None):
3062
3147
  """The refusal line for this edit event, or None when the edit may proceed.
3063
3148
  Without a root, the project is the one holding the edited file (hook_project)."""
@@ -3098,10 +3183,12 @@ def verdict_reason(payload, root=None, docs_name=None):
3098
3183
  f"guides ({docs_dir()}/reference/INDEX.md). Declare it with the level, e.g. "
3099
3184
  "\"Level: L2 · router: no match\" or \"router: GUIDE_x.md -> read\" "
3100
3185
  "(L1: \"Level: L1\"), then retry.")
3101
- unread = sorted((facts["named"] & guides) - facts["read"])
3186
+ unread = sorted(g for g in facts["named"] & guides
3187
+ if not _read_whole(facts["read"].get(g), _guide_lines(ref / g)))
3102
3188
  if unread:
3103
- return (f"[sdlc verdict] The router verdict names {', '.join(unread)}, not read in "
3104
- "this session. Read it, then retry.")
3189
+ return (f"[sdlc verdict] The router verdict names {', '.join(unread)}, not read "
3190
+ "whole in this session. Read every line (no offset or limit; past the read "
3191
+ "cap, in chunks to the end), then retry.")
3105
3192
  return None
3106
3193
 
3107
3194
 
@@ -4197,7 +4284,7 @@ def cmd_orient(args):
4197
4284
  left = share - len("\n".join(head + tail)) - 2
4198
4285
  body = []
4199
4286
  for rel, title, builder, cap in (
4200
- (router_rel, "## Guide router (reference/INDEX.md) -- read the matching guide before acting",
4287
+ (router_rel, "## Guide router (reference/INDEX.md) -- read a matching guide whole, every line, before acting",
4201
4288
  _orient_router_lines, ORIENT_ROUTER_CHARS),
4202
4289
  (handoff_rel, "## Workstream registry (audit/handoff.md)",
4203
4290
  _orient_registry_lines, ORIENT_REGISTRY_CHARS),