@nanhara/hara 0.104.0 → 0.105.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 +8 -0
- package/dist/agent/loop.js +9 -1
- package/dist/agent/reminders.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to `@nanhara/hara`.
|
|
|
5
5
|
> Versioning (pre-1.0, SemVer-style): the **minor** (middle) number bumps for a **new feature**; the
|
|
6
6
|
> **patch** (last) number bumps for **optimizations/fixes of existing features**.
|
|
7
7
|
|
|
8
|
+
## 0.105.0 — fan-outs synthesize before acting
|
|
9
|
+
|
|
10
|
+
- **Synthesis nudge** (the last adopted item from the Claude Code internals study — their KN5
|
|
11
|
+
synthesizer, hara-shaped): when a round returns **3+ parallel agent reports**, a silent
|
|
12
|
+
system-reminder tells the model to merge them first — reconcile overlaps and conflicts explicitly,
|
|
13
|
+
note what only one report saw, state the merged conclusion — instead of anchoring on whichever
|
|
14
|
+
report happens to sit last in context. Rides the 0.100.0 reminder layer; no new machinery.
|
|
15
|
+
|
|
8
16
|
## 0.104.0 — compaction keeps your working files + honest context accounting
|
|
9
17
|
|
|
10
18
|
Closes the last two adopted items from the Claude Code internals study, and un-breaks the release
|
package/dist/agent/loop.js
CHANGED
|
@@ -11,7 +11,7 @@ import { classifyRisk, guardianVeto, guardianEnabled, newBreaker, recordBlock }
|
|
|
11
11
|
import { subdirHint } from "../context/subdir-hints.js";
|
|
12
12
|
import { classifyError, failoverAction, errorHint } from "./failover.js";
|
|
13
13
|
import { currentTodos, renderTodos } from "../tools/todo.js";
|
|
14
|
-
import { drainReminders, wrapReminders, pushReminder, todoStaleReminder, TODO_STALE_ROUNDS } from "./reminders.js";
|
|
14
|
+
import { drainReminders, wrapReminders, pushReminder, todoStaleReminder, TODO_STALE_ROUNDS, synthesisReminder, SYNTHESIS_MIN_AGENTS } from "./reminders.js";
|
|
15
15
|
import { setTurnPhase } from "./phase.js";
|
|
16
16
|
import { recordTouch } from "./touched.js";
|
|
17
17
|
import { resolve as resolvePath } from "node:path";
|
|
@@ -422,6 +422,14 @@ export async function runAgent(history, opts) {
|
|
|
422
422
|
}
|
|
423
423
|
await flush();
|
|
424
424
|
history.push({ role: "tool", results });
|
|
425
|
+
// Synthesis nudge (CC's KN5, hara-shaped): a round that fanned out to several parallel agents just
|
|
426
|
+
// produced N independent reports — remind the model to merge/reconcile them before acting, instead
|
|
427
|
+
// of anchoring on whichever report happens to sit last in context.
|
|
428
|
+
if (!opts.quiet) {
|
|
429
|
+
const fanout = r.toolUses.filter((tu) => tu.name === "agent").length;
|
|
430
|
+
if (fanout >= SYNTHESIS_MIN_AGENTS)
|
|
431
|
+
pushReminder(synthesisReminder(fanout));
|
|
432
|
+
}
|
|
425
433
|
// Todo attention-refresh: a round that touched the checklist resets the clock; rounds that leave
|
|
426
434
|
// unfinished items untouched accumulate, and at TODO_STALE_ROUNDS the model gets a system-reminder
|
|
427
435
|
// re-showing the authoritative list (then the counter re-arms — at most one nag per N rounds).
|
package/dist/agent/reminders.js
CHANGED
|
@@ -30,6 +30,15 @@ export function wrapReminders(items) {
|
|
|
30
30
|
/** How many tool rounds a checklist may sit untouched (with unfinished items) before the model gets an
|
|
31
31
|
* attention refresh. Reset on every todo_write; re-arms after firing so it nags at most once per N. */
|
|
32
32
|
export const TODO_STALE_ROUNDS = 5;
|
|
33
|
+
/** Parallel fan-outs at/above this size get a synthesis nudge (CC's KN5 synthesizer, hara-shaped:
|
|
34
|
+
* instead of a dedicated merger agent, the MAIN model is reminded to merge before acting). */
|
|
35
|
+
export const SYNTHESIS_MIN_AGENTS = 3;
|
|
36
|
+
/** The synthesis nudge: N independent reports just landed — reconcile before acting. */
|
|
37
|
+
export function synthesisReminder(n) {
|
|
38
|
+
return (`You just received ${n} parallel agent reports. Before acting, SYNTHESIZE them into one coherent ` +
|
|
39
|
+
"picture: reconcile overlaps and conflicts explicitly (say which report wins and why), note anything " +
|
|
40
|
+
"only one report saw, and state the merged conclusion. Don't act on a single report in isolation.");
|
|
41
|
+
}
|
|
33
42
|
/** The staleness nudge: re-show the authoritative list + ask for a status pass. */
|
|
34
43
|
export function todoStaleReminder(renderedTodos) {
|
|
35
44
|
return (`Your todo list has not been updated in a while. Current state:\n\n${renderedTodos}\n\n` +
|