@rubytech/create-realagent-code 0.1.254 → 0.1.255
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/package.json +1 -1
- package/payload/platform/.docs/search-surface-contract.md +58 -0
- package/payload/platform/lib/embed-client/dist/index.d.ts +4 -0
- package/payload/platform/lib/embed-client/dist/index.d.ts.map +1 -0
- package/payload/platform/lib/embed-client/dist/index.js +53 -0
- package/payload/platform/lib/embed-client/dist/index.js.map +1 -0
- package/payload/platform/lib/embed-client/src/index.ts +53 -0
- package/payload/platform/lib/embed-client/tsconfig.json +8 -0
- package/payload/platform/lib/graph-search/dist/index.d.ts +27 -6
- package/payload/platform/lib/graph-search/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/graph-search/dist/index.js +19 -1
- package/payload/platform/lib/graph-search/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-search/src/index.ts +28 -6
- package/payload/platform/lib/graph-write/dist/index.d.ts +25 -0
- package/payload/platform/lib/graph-write/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/graph-write/dist/index.js +78 -2
- package/payload/platform/lib/graph-write/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-write/src/index.ts +96 -1
- package/payload/platform/package.json +2 -2
- package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/admin/PLUGIN.md +3 -3
- package/payload/platform/plugins/admin/hooks/__tests__/{session-end-retrospective.test.sh → insight.test.sh} +152 -153
- package/payload/platform/plugins/admin/hooks/insight.sh +219 -0
- package/payload/platform/plugins/admin/hooks/lib/admin-graph-pass-common.sh +5 -5
- package/payload/platform/plugins/admin/mcp/dist/index.js +33 -19
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +23 -23
- package/payload/platform/plugins/docs/references/graph.md +2 -0
- package/payload/platform/plugins/docs/references/internals.md +12 -1
- package/payload/platform/plugins/docs/references/neo4j.md +2 -2
- package/payload/platform/plugins/docs/references/platform.md +1 -1
- package/payload/platform/plugins/docs/references/session-retrospective.md +5 -18
- package/payload/platform/plugins/email/PLUGIN.md +2 -2
- package/payload/platform/plugins/email/mcp/dist/index.js +8 -0
- package/payload/platform/plugins/email/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/attachment-resolve.d.ts +19 -0
- package/payload/platform/plugins/email/mcp/dist/lib/attachment-resolve.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/attachment-resolve.js +64 -0
- package/payload/platform/plugins/email/mcp/dist/lib/attachment-resolve.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.d.ts +4 -0
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.js +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-reply.d.ts +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-reply.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-reply.js +6 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-reply.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-send.d.ts +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-send.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-send.js +7 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-send.js.map +1 -1
- package/payload/platform/plugins/email/references/email-reference.md +4 -0
- package/payload/platform/plugins/memory/PLUGIN.md +1 -2
- package/payload/platform/plugins/memory/mcp/dist/index.js +5 -43
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/document-sectioniser.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/document-sectioniser.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/document-sectioniser.test.js +41 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/document-sectioniser.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-embed-net.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-embed-net.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-embed-net.test.js +90 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-embed-net.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/vector-indexed-labels-drift.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/vector-indexed-labels-drift.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/vector-indexed-labels-drift.test.js +27 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/vector-indexed-labels-drift.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-sectioniser.d.ts +10 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-sectioniser.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-sectioniser.js +47 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/document-sectioniser.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/embeddings.d.ts +1 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/embeddings.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/embeddings.js +5 -28
- package/payload/platform/plugins/memory/mcp/dist/lib/embeddings.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/build-text-representation-bound.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/build-text-representation-bound.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/build-text-representation-bound.test.js +20 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/build-text-representation-bound.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-preference-embed.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-preference-embed.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-preference-embed.test.js +67 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-preference-embed.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embeddings-cap.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embeddings-cap.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embeddings-cap.test.js +34 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embeddings-cap.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-section-writer.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-section-writer.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-section-writer.test.js +61 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-section-writer.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write.test.js +23 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex.test.js +87 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.js +3 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-threshold.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-threshold.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-threshold.test.js +34 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-threshold.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js +19 -4
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.d.ts +33 -6
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js +280 -10
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-reindex.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-reindex.js +76 -37
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-reindex.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js +11 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.d.ts +3 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.js +2 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +10 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js +6 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/vitest.config.ts +5 -0
- package/payload/platform/plugins/memory/references/schema-base.md +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/ics-graph-ingest.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/ics-graph-ingest.js +15 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/ics-graph-ingest.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js +4 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js.map +1 -1
- package/payload/platform/scripts/identity-forbidden-token-check.mjs +0 -1
- package/payload/platform/scripts/setup-account.sh +2 -8
- package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.d.ts +23 -0
- package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.js +29 -0
- package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +0 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +8 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts +13 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js +26 -2
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts +12 -3
- package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/system-prompt.js +3 -2
- package/payload/platform/services/claude-session-manager/dist/system-prompt.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +2 -2
- package/payload/platform/templates/specialists/agents/database-operator.md +2 -6
- package/payload/server/{chunk-M6A6EZD4.js → chunk-76HRO7NX.js} +16 -2
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/server.js +473 -28
- package/payload/platform/plugins/admin/hooks/session-end-retrospective.sh +0 -214
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Stop hook — gates session termination until the admin agent has performed
|
|
3
|
-
# a four-pass retrospective (technical learnings, operator-relationship
|
|
4
|
-
# updates, graph-completeness sweep, typed-edge auto-extraction) and called
|
|
5
|
-
# the deterministic `session-retrospective-mark-complete` MCP sentinel
|
|
6
|
-
# tool. Task 282; converged onto the Task 439 shared helper.
|
|
7
|
-
#
|
|
8
|
-
# Trigger detection. End-intent is the operator's most recent real-user
|
|
9
|
-
# message matching one of the literal token strings:
|
|
10
|
-
# /end | /archive | end session | archive this session
|
|
11
|
-
# "Real user" follows the same shape used by
|
|
12
|
-
# askuserquestion-investigate-gate.sh — `type=user, message.role=user,
|
|
13
|
-
# content` is a string OR a list with at least one non-`tool_result` block.
|
|
14
|
-
# `tool_result`-only user records are tool replies, not turn starts, and
|
|
15
|
-
# never count as the latest user message.
|
|
16
|
-
#
|
|
17
|
-
# The Sidebar Archive button POSTs `/:sessionId/archive` which kills the
|
|
18
|
-
# PTY directly — no Stop fires after that, so clicking Archive is the
|
|
19
|
-
# operator's de-facto skip path. The spec lists opt-out as a deferred
|
|
20
|
-
# follow-up; archive-click is its current shape and acceptable behaviour.
|
|
21
|
-
#
|
|
22
|
-
# Sentinel detection. Completion is recognised by greping the operator's
|
|
23
|
-
# own JSONL (transcript_path on the Stop envelope) for a `tool_use` block
|
|
24
|
-
# whose `name` is exactly `mcp__admin__session-retrospective-mark-complete`
|
|
25
|
-
# — that is the prefixed form Claude Code writes for MCP tools in the
|
|
26
|
-
# JSONL; the unprefixed name only appears in the operator-facing
|
|
27
|
-
# instruction text below. The sentinel-grep doubles as the re-entry guard:
|
|
28
|
-
# every Stop that fires after the agent's sentinel call sees the sentinel
|
|
29
|
-
# and exits 0 with `gate-released`, so the agent's wrap-up turn never
|
|
30
|
-
# re-blocks.
|
|
31
|
-
# [[feedback_no_stdout_parsing_for_control_flow]],
|
|
32
|
-
# [[feedback_doctrine_paragraph_is_not_a_gate]] — the LLM is removed from
|
|
33
|
-
# the per-decision path entirely.
|
|
34
|
-
#
|
|
35
|
-
# Gating (common guards live in `lib/admin-graph-pass-common.sh`; this
|
|
36
|
-
# hook adds the end-intent gating layered on top):
|
|
37
|
-
# - role-not-admin / is-specialist / empty-stdin / missing-transcript:
|
|
38
|
-
# handled by the shared helper, emit `trigger-skipped` and exit 0.
|
|
39
|
-
# - no-intent-match: latest real-user message has no end-intent token,
|
|
40
|
-
# emit `trigger-skipped` and exit 0.
|
|
41
|
-
#
|
|
42
|
-
# Releases:
|
|
43
|
-
# - gate-released sessionId=<id> (when sentinel present in transcript)
|
|
44
|
-
#
|
|
45
|
-
# Blocks:
|
|
46
|
-
# - gate-blocked sessionId=<id> reason=sentinel-absent
|
|
47
|
-
# (exit 2; stderr carries the four-pass retrospective instruction —
|
|
48
|
-
# stderr is the Stop-hook contract for handing instructions back to
|
|
49
|
-
# the agent).
|
|
50
|
-
#
|
|
51
|
-
# Input: Claude Code's Stop hook stdin shape
|
|
52
|
-
# { "session_id": "<intrinsic>", "transcript_path": "<jsonl path>", ... }
|
|
53
|
-
|
|
54
|
-
set -uo pipefail
|
|
55
|
-
|
|
56
|
-
AGP_LOG_TAG="session-retrospective"
|
|
57
|
-
AGP_LIB="$(dirname "$0")/lib/admin-graph-pass-common.sh"
|
|
58
|
-
if [ ! -f "$AGP_LIB" ]; then
|
|
59
|
-
echo "[${AGP_LOG_TAG}] trigger-skipped sessionId=unknown reason=missing-helper path=${AGP_LIB}" >&2
|
|
60
|
-
exit 0
|
|
61
|
-
fi
|
|
62
|
-
# shellcheck source=lib/admin-graph-pass-common.sh
|
|
63
|
-
source "$AGP_LIB"
|
|
64
|
-
|
|
65
|
-
agp_setup_logging
|
|
66
|
-
agp_read_stdin
|
|
67
|
-
agp_parse_stdin
|
|
68
|
-
agp_guard_role_specialist
|
|
69
|
-
agp_guard_transcript require-stdin
|
|
70
|
-
|
|
71
|
-
# Single Python pass walks the transcript and reports two facts:
|
|
72
|
-
# 1. The latest end-intent token in the most recent real-user message,
|
|
73
|
-
# or empty if no real user message matches.
|
|
74
|
-
# 2. Whether any `tool_use` block in the transcript names the sentinel
|
|
75
|
-
# tool `mcp__admin__session-retrospective-mark-complete`.
|
|
76
|
-
# Output one line: <intent-token-or-empty>\t<sentinel-present-yes|no>
|
|
77
|
-
INSPECTION=$(TRANSCRIPT_PATH="$TRANSCRIPT_PATH" python3 - <<'PY'
|
|
78
|
-
import os, json
|
|
79
|
-
|
|
80
|
-
SENTINEL_TOOL = "mcp__admin__session-retrospective-mark-complete"
|
|
81
|
-
INTENT_TOKENS = ("/end", "/archive", "end session", "archive this session")
|
|
82
|
-
|
|
83
|
-
def is_real_user(rec):
|
|
84
|
-
if not isinstance(rec, dict) or rec.get("type") != "user":
|
|
85
|
-
return False
|
|
86
|
-
msg = rec.get("message")
|
|
87
|
-
if not isinstance(msg, dict) or msg.get("role") != "user":
|
|
88
|
-
return False
|
|
89
|
-
content = msg.get("content")
|
|
90
|
-
if isinstance(content, str):
|
|
91
|
-
return True
|
|
92
|
-
if isinstance(content, list):
|
|
93
|
-
for b in content:
|
|
94
|
-
if isinstance(b, dict) and b.get("type") != "tool_result":
|
|
95
|
-
return True
|
|
96
|
-
return False
|
|
97
|
-
return True
|
|
98
|
-
|
|
99
|
-
def extract_user_text(rec):
|
|
100
|
-
msg = rec.get("message", {}) or {}
|
|
101
|
-
content = msg.get("content")
|
|
102
|
-
if isinstance(content, str):
|
|
103
|
-
return content
|
|
104
|
-
if isinstance(content, list):
|
|
105
|
-
out = []
|
|
106
|
-
for b in content:
|
|
107
|
-
if not isinstance(b, dict):
|
|
108
|
-
continue
|
|
109
|
-
if b.get("type") == "text":
|
|
110
|
-
t = b.get("text")
|
|
111
|
-
if isinstance(t, str):
|
|
112
|
-
out.append(t)
|
|
113
|
-
return "".join(out)
|
|
114
|
-
return ""
|
|
115
|
-
|
|
116
|
-
def assistant_tool_use_names(rec):
|
|
117
|
-
if not isinstance(rec, dict) or rec.get("type") != "assistant":
|
|
118
|
-
return []
|
|
119
|
-
msg = rec.get("message", {}) or {}
|
|
120
|
-
if msg.get("role") != "assistant":
|
|
121
|
-
return []
|
|
122
|
-
content = msg.get("content")
|
|
123
|
-
if not isinstance(content, list):
|
|
124
|
-
return []
|
|
125
|
-
names = []
|
|
126
|
-
for b in content:
|
|
127
|
-
if isinstance(b, dict) and b.get("type") == "tool_use":
|
|
128
|
-
n = b.get("name")
|
|
129
|
-
if isinstance(n, str):
|
|
130
|
-
names.append(n)
|
|
131
|
-
return names
|
|
132
|
-
|
|
133
|
-
path = os.environ["TRANSCRIPT_PATH"]
|
|
134
|
-
records = []
|
|
135
|
-
try:
|
|
136
|
-
with open(path, "r", encoding="utf-8") as f:
|
|
137
|
-
for raw in f:
|
|
138
|
-
raw = raw.strip()
|
|
139
|
-
if not raw:
|
|
140
|
-
continue
|
|
141
|
-
try:
|
|
142
|
-
records.append(json.loads(raw))
|
|
143
|
-
except Exception:
|
|
144
|
-
continue
|
|
145
|
-
except Exception:
|
|
146
|
-
print("\tno")
|
|
147
|
-
raise SystemExit(0)
|
|
148
|
-
|
|
149
|
-
# Sentinel presence — any assistant tool_use of the sentinel tool anywhere
|
|
150
|
-
# in this session's JSONL.
|
|
151
|
-
sentinel_present = False
|
|
152
|
-
for r in records:
|
|
153
|
-
if SENTINEL_TOOL in assistant_tool_use_names(r):
|
|
154
|
-
sentinel_present = True
|
|
155
|
-
break
|
|
156
|
-
|
|
157
|
-
# Latest real-user message text.
|
|
158
|
-
latest_user_text = ""
|
|
159
|
-
for r in reversed(records):
|
|
160
|
-
if is_real_user(r):
|
|
161
|
-
latest_user_text = extract_user_text(r).strip()
|
|
162
|
-
break
|
|
163
|
-
|
|
164
|
-
matched = ""
|
|
165
|
-
if latest_user_text:
|
|
166
|
-
# Case-insensitive whole-message match against the token set. A token
|
|
167
|
-
# must appear as the entire user message (after .strip()), or as a
|
|
168
|
-
# standalone line within it — not embedded inside a paragraph. Keeps
|
|
169
|
-
# the gate from false-positiving on "I'll end session by 5pm" prose.
|
|
170
|
-
haystacks = {latest_user_text.lower()}
|
|
171
|
-
for line in latest_user_text.splitlines():
|
|
172
|
-
s = line.strip().lower()
|
|
173
|
-
if s:
|
|
174
|
-
haystacks.add(s)
|
|
175
|
-
for tok in INTENT_TOKENS:
|
|
176
|
-
if tok.lower() in haystacks:
|
|
177
|
-
matched = tok
|
|
178
|
-
break
|
|
179
|
-
|
|
180
|
-
print(f"{matched}\t{'yes' if sentinel_present else 'no'}")
|
|
181
|
-
PY
|
|
182
|
-
)
|
|
183
|
-
INTENT_TOKEN="${INSPECTION%% *}"
|
|
184
|
-
SENTINEL_PRESENT="${INSPECTION#* }"
|
|
185
|
-
|
|
186
|
-
if [ -z "$INTENT_TOKEN" ]; then
|
|
187
|
-
agp_emit_log "trigger-skipped sessionId=${SESSION_ID} reason=no-intent-match"
|
|
188
|
-
exit 0
|
|
189
|
-
fi
|
|
190
|
-
|
|
191
|
-
agp_emit_log "trigger sessionId=${SESSION_ID} token=${INTENT_TOKEN}"
|
|
192
|
-
|
|
193
|
-
if [ "$SENTINEL_PRESENT" = "yes" ]; then
|
|
194
|
-
agp_emit_log "gate-released sessionId=${SESSION_ID}"
|
|
195
|
-
exit 0
|
|
196
|
-
fi
|
|
197
|
-
|
|
198
|
-
agp_emit_log "gate-blocked sessionId=${SESSION_ID} reason=sentinel-absent"
|
|
199
|
-
|
|
200
|
-
cat >&2 <<'INSTRUCTION'
|
|
201
|
-
The operator signalled session end. Before this session can close, run the four-pass retrospective inside this same admin session — do not spawn a new session, do not background anything. Use the tools you already have.
|
|
202
|
-
|
|
203
|
-
Pass 1 — Technical learnings. Walk this session for operator corrections and self-detected mistakes. For each one, delegate one graph write to `database-operator` via the Task tool, persisting a Learning or Correction node per the schema. Count what you write.
|
|
204
|
-
|
|
205
|
-
Pass 2 — Operator-relationship updates. Walk this session for tonal signals, rejected phrasings, and working-style preferences. For each one worth carrying forward, Write the observation into `SOUL.md` at the account-scoped path. Count what you write.
|
|
206
|
-
|
|
207
|
-
Pass 3 — Graph completeness sweep. Walk this session for any node, edge, or commitment that was discussed but not written to the graph in-flight. For each missing write, delegate to `database-operator` via the Task tool. Count what you write.
|
|
208
|
-
|
|
209
|
-
Pass 4 — Typed-edge auto-extraction. Delegate to `database-operator` via the Task tool with a prompt naming the typed-edge pass and the session-start timestamp. The specialist calls `memory-typed-edge-pass` with that timestamp and returns the counters. Capture `nodesProcessed` and the accepted count from its reply.
|
|
210
|
-
|
|
211
|
-
Then call `session-retrospective-mark-complete` with all five counts (learningsCount, preferencesCount, graphWriteCount, typedEdgesCount, nodesProcessed) and reply with one short paragraph in your house voice summarising what you wrote.
|
|
212
|
-
INSTRUCTION
|
|
213
|
-
|
|
214
|
-
exit 2
|