navori 0.7.4 → 0.7.5
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/dist/assets/core/core-assets/agents/researcher.md +1 -1
- package/dist/assets/core/core-assets/hooks/session-start-context.sh +42 -0
- package/dist/assets/core/core-assets/managed/arranque-sesion.md +2 -0
- package/dist/assets/core/core-assets/skills/structural-search.md +3 -1
- package/dist/index.js +251 -250
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ hypothetical future abstractions or optional edge cases as BLOCKER.
|
|
|
37
37
|
1. `CLAUDE.md` carries the repo's context — it is already in your context when your host injects it; read it from disk ONLY if your host did not inject it.
|
|
38
38
|
2. Work on ONE scoped question (the orchestrator already handed you the scope). If you discover it's actually >2 independent questions, return them as a list so the orchestrator distributes them across parallel researchers — don't chain them in series yourself.
|
|
39
39
|
3. Run the search:
|
|
40
|
-
- Primary method: the native `Grep` (content) and `Glob` (files by name/pattern) tools. They're read-only, fast (ripgrep), and don't ask for permission.
|
|
40
|
+
- Primary method: the native `Grep` (content) and `Glob` (files by name/pattern) tools. They're read-only, fast (ripgrep), and don't ask for permission. In auto mode the shell additionally pays a classifier round-trip per command — measured, a native search answers in ~0.08s against ~0.20s (p75 1.83s) for the same search through the shell — so the native lane is cheaper in every mode and much cheaper there.
|
|
41
41
|
- Fallback only for what the tools don't cover (git history with `git grep`, FS metadata with `find`): shell commands. Chained with pipes/redirects they ask for confirmation, so reserve the shell for when `Grep`/`Glob` fall short.
|
|
42
42
|
- For semantic questions (not just string match), apply `.claude/skills/structural-search/SKILL.md`: locate the right region and open only the confirmed span; don't read whole files by reflex.
|
|
43
43
|
4. Validate each finding: open the file, confirm the match means what it seems (sometimes a `grep` matches comments or strings unrelated to the concept).
|
|
@@ -58,6 +58,48 @@ trap navori_audit_on_exit EXIT
|
|
|
58
58
|
ctx=""
|
|
59
59
|
add() { ctx="${ctx}${1}"$'\n'; }
|
|
60
60
|
|
|
61
|
+
# ─── Armed audit-mode (#597): consume the flag `navori audit --arm` left ─────
|
|
62
|
+
#
|
|
63
|
+
# Activation used to depend on the MODEL's attention: "do it in audit mode"
|
|
64
|
+
# inside a task prompt loses to the task, and the natural-language detection
|
|
65
|
+
# was removed on purpose (spec 0013 R3 — invoking the mode is indistinguishable
|
|
66
|
+
# from talking about it). This is the mechanical path: the user arms from the
|
|
67
|
+
# terminal BEFORE opening the session, and this hook — the only party that
|
|
68
|
+
# knows the new session's id — runs `--start` itself.
|
|
69
|
+
#
|
|
70
|
+
# Consumption comes FIRST: the flag arms exactly ONE session. If `--start`
|
|
71
|
+
# then fails, the arm is lost rather than latched — a flag that survives a
|
|
72
|
+
# failure would fire on some later unrelated session, which is worse than
|
|
73
|
+
# asking the user to arm again. Fail-open throughout: this hook's contract is
|
|
74
|
+
# to never break a session, so every step tolerates absence and moves on.
|
|
75
|
+
_armed_root=${NAVORI_AUDITS_ROOT:-${HOME:-}/.navori/audits}
|
|
76
|
+
# The authoritative repo comes from the payload's `cwd`, same as the recorder
|
|
77
|
+
# partial (#454): the hook process can start somewhere other than the session's
|
|
78
|
+
# repo, and `--arm` wrote the flag under the name `basename(cwd)` resolves to.
|
|
79
|
+
_armed_cwd=""
|
|
80
|
+
if command -v jq >/dev/null 2>&1; then
|
|
81
|
+
_armed_cwd=$(printf '%s' "$payload" | jq -r '.cwd // ""' 2>/dev/null || true)
|
|
82
|
+
fi
|
|
83
|
+
[ -n "$_armed_cwd" ] || _armed_cwd=${CLAUDE_PROJECT_DIR:-$PWD}
|
|
84
|
+
_armed_repo=$(basename "$_armed_cwd" 2>/dev/null || true)
|
|
85
|
+
if [ -n "$_armed_repo" ] && [ -f "$_armed_root/$_armed_repo/.armed" ] \
|
|
86
|
+
&& command -v jq >/dev/null 2>&1 && command -v navori >/dev/null 2>&1; then
|
|
87
|
+
_armed_sid=$(printf '%s' "$payload" | jq -r '.session_id // ""' 2>/dev/null || true)
|
|
88
|
+
# Same charset guard the CLI and the recorder apply (#503): a path-shaped id
|
|
89
|
+
# means the payload is not what we think it is — do nothing rather than guess.
|
|
90
|
+
case "$_armed_sid" in
|
|
91
|
+
"" | *[!A-Za-z0-9_-]*) : ;;
|
|
92
|
+
*)
|
|
93
|
+
rm -f "$_armed_root/$_armed_repo/.armed" 2>/dev/null || true
|
|
94
|
+
if navori audit --start "$_armed_sid" --cwd "$_armed_cwd" >/dev/null 2>&1; then
|
|
95
|
+
# Tell the MODEL, not just the log: the session should know it is being
|
|
96
|
+
# recorded, and the user should see the activation in the first turn.
|
|
97
|
+
add "navori: audit-mode ACTIVO para esta sesión (armado con 'navori audit --arm'; el hook corrió --start ${_armed_sid})."
|
|
98
|
+
fi
|
|
99
|
+
;;
|
|
100
|
+
esac
|
|
101
|
+
fi
|
|
102
|
+
|
|
61
103
|
# UNTRUSTED-DATA FENCE (#511). Two of the three things this hook injects are
|
|
62
104
|
# repository CONTENT, not harness instruction: commit subjects and the body of
|
|
63
105
|
# `progress/current.md`. Anyone who can push can write either, and both land at
|
|
@@ -4,3 +4,5 @@ On Claude, a `SessionStart` hook injects the live context — branch, recent com
|
|
|
4
4
|
|
|
5
5
|
1. **Healthy config**: run `navori doctor` if `navori.config.json` / `.claude/` look inconsistent, or to confirm the declared quality gates can actually run.
|
|
6
6
|
2. **Scoped task**: one **user** task at a time; decompose and parallelize per your orchestrator role.
|
|
7
|
+
|
|
8
|
+
**Audit mode on request**: if the user asks for it in any wording ("audit mode", "con auditoría", "navori audit"), run `navori audit --start <this session's id>` as the FIRST action of that turn — before loading skills or starting any pipeline — and confirm the log path it prints. The phrase never activates anything by itself (by design); the command is the only switch. If the injected context already says audit-mode is ACTIVE (armed via `navori audit --arm`), it is running — do not start it again.
|
|
@@ -20,8 +20,10 @@ Confirm every pointer with a cheap search. If the code contradicts memory, corre
|
|
|
20
20
|
|
|
21
21
|
Use it when you know a literal token: name, import, config key, error string.
|
|
22
22
|
|
|
23
|
+
Native `Grep` first — it IS ripgrep, pre-approved, ~0.08s vs ~0.20s (p75 1.83s) by shell, which in auto mode also pays a classifier round-trip. Shell `rg` is the fallback (git history, context flags), not the default.
|
|
24
|
+
|
|
23
25
|
1. Start narrow: file, directory or type obtained in Rung 0.
|
|
24
|
-
2. Ask first for files (`rg -l`) or `file:line` with at most two lines of context.
|
|
26
|
+
2. Ask first for files (`Grep` files mode; `rg -l` via shell) or `file:line` with at most two lines of context.
|
|
25
27
|
3. Dedup before reading.
|
|
26
28
|
4. Open only the span that confirms the hit.
|
|
27
29
|
|