switchroom 0.20.9 → 0.20.11
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/bin/handoff-briefing.sh +57 -5
- package/bin/working-state-reload-hook.sh +262 -0
- package/dist/agent-scheduler/index.js +65 -2
- package/dist/auth-broker/index.js +204 -24
- package/dist/cli/notion-write-pretool.mjs +65 -2
- package/dist/cli/self-improve-apply-guard-pretool.mjs +357 -92
- package/dist/cli/self-improve-stop.mjs +889 -7
- package/dist/cli/skill-validate-pretool.mjs +82 -3
- package/dist/cli/switchroom.js +3699 -2110
- package/dist/host-control/main.js +67 -4
- package/dist/vault/approvals/kernel-server.js +66 -3
- package/dist/vault/broker/server.js +66 -3
- package/package.json +1 -1
- package/profiles/_base/start.sh.hbs +49 -0
- package/profiles/_shared/agent-self-service.md.hbs +15 -22
- package/profiles/_shared/delegation-golden-rule.md.hbs +1 -1
- package/profiles/_shared/dev-protocol.md.hbs +1 -1
- package/profiles/_shared/execution-discipline.md.hbs +4 -4
- package/profiles/_shared/vault-protocol.md.hbs +2 -18
- package/profiles/default/CLAUDE.md.hbs +3 -5
- package/telegram-plugin/auto-fallback-fleet.ts +37 -2
- package/telegram-plugin/dist/gateway/gateway.js +1414 -918
- package/telegram-plugin/fallback-card-collapse.ts +1 -0
- package/telegram-plugin/gateway/auth-command.ts +11 -1
- package/telegram-plugin/gateway/callback-query-handlers.ts +100 -0
- package/telegram-plugin/gateway/eval-case-proposal-card.ts +86 -0
- package/telegram-plugin/gateway/fleet-fallback-notice-cooldown.test.ts +74 -0
- package/telegram-plugin/gateway/fleet-fallback-notice-cooldown.ts +71 -0
- package/telegram-plugin/gateway/gateway.ts +85 -90
- package/telegram-plugin/gateway/ipc-protocol.ts +43 -0
- package/telegram-plugin/gateway/ipc-server.ts +28 -0
- package/telegram-plugin/gateway/narrative-lane.ts +33 -2
- package/telegram-plugin/gateway/privacy-reset.test.ts +216 -0
- package/telegram-plugin/gateway/privacy-reset.ts +87 -0
- package/telegram-plugin/gateway/privacy-state.test.ts +165 -0
- package/telegram-plugin/gateway/privacy-state.ts +206 -0
- package/telegram-plugin/gateway/self-improve-proposal-wiring.ts +176 -0
- package/telegram-plugin/gateway/stale-pin-sweep-wiring.ts +24 -14
- package/telegram-plugin/gateway/stale-pin-sweep.test.ts +123 -26
- package/telegram-plugin/gateway/stale-pin-sweep.ts +48 -32
- package/telegram-plugin/gateway/throttle-tier-wiring.ts +15 -4
- package/telegram-plugin/slot-banner-driver.ts +42 -5
- package/telegram-plugin/tests/auto-fallback-fleet.test.ts +24 -0
- package/telegram-plugin/tests/gateway-handler-registration-wiring.test.ts +2 -0
- package/telegram-plugin/tests/narrative-lane-golden.test.ts +97 -0
- package/telegram-plugin/tests/privacy-reset-call-sites.test.ts +120 -0
- package/telegram-plugin/tests/status-pin-store.test.ts +25 -0
- package/telegram-plugin/tests/throttle-tier.test.ts +16 -0
- package/telegram-plugin/tests/turn-flush-safety.test.ts +67 -0
- package/telegram-plugin/throttle-tier.ts +12 -3
- package/telegram-plugin/turn-flush-safety.ts +97 -0
- package/vendor/hindsight-memory/CHANGELOG.md +31 -0
- package/vendor/hindsight-memory/hooks/hooks.json +2 -1
- package/vendor/hindsight-memory/scripts/retain.py +306 -0
- package/vendor/hindsight-memory/scripts/session_start.py +35 -8
- package/vendor/hindsight-memory/scripts/subagent_retain.py +29 -1
- package/vendor/hindsight-memory/scripts/tests/test_private_mode.py +415 -0
- package/vendor/hindsight-memory/scripts/tests/test_self_improve_correction_tag.py +167 -0
- package/vendor/hindsight-memory/scripts/tests/test_session_start_durability.py +107 -0
|
@@ -28,7 +28,7 @@ You are operating in the **{{topicName}}** {{#if topicEmoji}}{{topicEmoji}} {{/i
|
|
|
28
28
|
- Prefer `trash` over `rm` when available (recoverable beats gone forever).
|
|
29
29
|
- Safe to do freely: read files, explore, organize, search the web, check calendars, work within this workspace.
|
|
30
30
|
- Ask first: sending emails, tweets, public posts, anything that leaves the machine, anything you're uncertain about.
|
|
31
|
-
- **Batch foreseeable approvals; don't drip surprises.** When
|
|
31
|
+
- **Batch foreseeable approvals; don't drip surprises.** When several actions will each need the user's approval, say up front which are coming and why: request independent ones together so they decide once; for dependent ones, say what's next — a permission card should never arrive out of the blue.
|
|
32
32
|
- **A timed-out approval isn't a denial.** If a request came back denied only because the user was away (a timeout, not an explicit "no"), don't silently abandon it. When they're back, remind them it's still pending and re-offer it if they still want it.
|
|
33
33
|
|
|
34
34
|
## Memory — Hindsight is your single backend
|
|
@@ -52,7 +52,7 @@ Hard rules the agent must follow during reflect — guardrails that are always a
|
|
|
52
52
|
|
|
53
53
|
- `mcp__hindsight__create_directive(text)` — e.g., `create_directive("Always prefer TypeScript over JavaScript for this user's projects")`. When the user gives you a correction or "always do X" rule, create a directive instead of writing a feedback `.md` file. If the rule can be enforced deterministically — a settings.json hook, a permission rule, a skill/script edit, or a config change — prefer that (instead of, or in addition to, the directive) and say which you did; reserve directives for judgment rules code can't enforce.
|
|
54
54
|
|
|
55
|
-
(Read-only inspection tools
|
|
55
|
+
(Read-only inspection tools — `list_memories`, `list_mental_models`, `get_mental_model`, `list_directives` — exist under `mcp__hindsight__*` if you ever need them, but you rarely should: auto-recall surfaces what matters and the operator curates the bank out-of-band.)
|
|
56
56
|
|
|
57
57
|
### What to retain — and what NOT to retain
|
|
58
58
|
|
|
@@ -68,7 +68,7 @@ Don't retain:
|
|
|
68
68
|
- Sensitive content the user explicitly asked you to not remember
|
|
69
69
|
- Things already in a mental model — they'll be re-derived from underlying memories
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
Auto-retain (see above) covers routine capture; use manual `retain` for high-signal observations you want immediately searchable.
|
|
72
72
|
|
|
73
73
|
### When to synthesize — concrete triggers
|
|
74
74
|
|
|
@@ -93,8 +93,6 @@ By default, every restart starts a **fresh `claude` session** — the in-flight
|
|
|
93
93
|
|
|
94
94
|
A config-summary greeting card is sent automatically by the SessionStart hook — you don't need to announce yourself. If your context feels thin (after compaction or any fresh session), proactively recall from Hindsight before proceeding.
|
|
95
95
|
|
|
96
|
-
(Operators can override the resume policy per-agent via `session_continuity.resume_mode` in switchroom.yaml — `auto`, `continue`, `handoff`, or `none`. The default is `handoff`.)
|
|
97
|
-
|
|
98
96
|
{{#if admin}}
|
|
99
97
|
## Admin surface
|
|
100
98
|
|
|
@@ -159,6 +159,18 @@ export type FleetFallbackOutcome =
|
|
|
159
159
|
oldLabel: string;
|
|
160
160
|
announcement: string;
|
|
161
161
|
oldQuota: QuotaUtilization | null;
|
|
162
|
+
}
|
|
163
|
+
| {
|
|
164
|
+
/** The triggering agent has a strict pin (`auth.strict`) — the broker
|
|
165
|
+
* marked its account but deliberately did not roll it. Distinct from
|
|
166
|
+
* 'no-eligible-target' so the gateway can apply its own notice
|
|
167
|
+
* cooldown: like all-blocked, this is a no-op outcome the ~60s
|
|
168
|
+
* quota_wall_detected re-trigger would otherwise re-broadcast for
|
|
169
|
+
* the life of the wall. */
|
|
170
|
+
kind: 'strict-pinned';
|
|
171
|
+
oldLabel: string;
|
|
172
|
+
announcement: string;
|
|
173
|
+
oldQuota: QuotaUtilization | null;
|
|
162
174
|
};
|
|
163
175
|
|
|
164
176
|
export interface FleetFallbackDeps {
|
|
@@ -177,7 +189,14 @@ export interface FleetFallbackDeps {
|
|
|
177
189
|
* /auth button uses) is gated to admin agents, so a non-admin agent that
|
|
178
190
|
* 429'd could never self-heal. mark-exhausted derives the account from the
|
|
179
191
|
* caller's own identity, so it needs no admin. */
|
|
180
|
-
failover: () => Promise<{
|
|
192
|
+
failover: () => Promise<{
|
|
193
|
+
rolledTo: string | null;
|
|
194
|
+
rolled: string[];
|
|
195
|
+
/** True when the triggering agent has a strict pin (`auth.strict`): its
|
|
196
|
+
* null `rolledTo` means it rides out the wall on its own account — NOT
|
|
197
|
+
* a fleet-wide all-blocked. Absent from pre-flag brokers → false. */
|
|
198
|
+
callerPinnedStrict?: boolean;
|
|
199
|
+
}>;
|
|
181
200
|
/** Agent that triggered this fallback (for the announcement byline). */
|
|
182
201
|
triggerAgent: string;
|
|
183
202
|
/** Operator timezone for absolute reset times in the announcement. */
|
|
@@ -259,7 +278,23 @@ export async function runFleetAutoFallback(
|
|
|
259
278
|
// choice (same `nextHealthyAccount` selection /auth rotate uses) rather than
|
|
260
279
|
// picking here, so the announcement matches what actually happened. Caller
|
|
261
280
|
// catches and surfaces failures — we don't double-wrap.
|
|
262
|
-
const { rolledTo } = await deps.failover();
|
|
281
|
+
const { rolledTo, callerPinnedStrict } = await deps.failover();
|
|
282
|
+
|
|
283
|
+
if (!rolledTo && callerPinnedStrict) {
|
|
284
|
+
// Strict pin: the broker marked the account but deliberately did not roll
|
|
285
|
+
// the caller (agents.<name>.auth.strict). Rendering the all-blocked card
|
|
286
|
+
// here would tell the operator the whole fleet is exhausted while the
|
|
287
|
+
// snapshots in that very card show healthy accounts.
|
|
288
|
+
return {
|
|
289
|
+
kind: 'strict-pinned',
|
|
290
|
+
oldLabel: oldSnap.label,
|
|
291
|
+
oldQuota: oldSnap.quota,
|
|
292
|
+
announcement:
|
|
293
|
+
`_**${escapeMarkdown(deps.triggerAgent)}** is strictly pinned to ` +
|
|
294
|
+
`${escapeMarkdown(oldSnap.label)} (\`auth.strict\`) — riding out the wall ` +
|
|
295
|
+
`on its own account. The rest of the fleet is unaffected._`,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
263
298
|
|
|
264
299
|
if (!rolledTo) {
|
|
265
300
|
// All-blocked path: the broker found no non-exhausted fallback. The active
|