@yahyahammad/venastine 0.3.8 → 0.3.10
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/.env.example +19 -19
- package/CONFIG_ARCHITECTURE.md +2139 -2002
- package/LICENSE +201 -201
- package/README.md +1043 -1034
- package/agents/builtin/compactor.md +75 -75
- package/agents/builtin/explore.md +77 -77
- package/agents/builtin/pipeline-reviewer.md +100 -100
- package/agents/builtin/plan.md +106 -106
- package/agents/builtin/review.md +74 -74
- package/agents/manager.py +261 -261
- package/agents/subagent_tool.py +472 -472
- package/agents/tui_commands.py +238 -146
- package/bin/venastine.mjs +584 -528
- package/bin/venastine.py +73 -71
- package/cli_commands.py +848 -835
- package/config.yaml +64 -0
- package/config_edit.py +1301 -1301
- package/config_schema.py +987 -966
- package/config_update.py +749 -749
- package/core/agent_activity.py +256 -256
- package/core/ansi.py +452 -452
- package/core/approval.py +137 -137
- package/core/call_view.py +364 -364
- package/core/cancel.py +121 -121
- package/core/chatgpt_auth.py +747 -747
- package/core/claims_view.py +107 -107
- package/core/client.py +2756 -2715
- package/core/commands.py +464 -454
- package/core/compaction.py +1735 -1735
- package/core/config_loader.py +1982 -1982
- package/core/connect.py +686 -686
- package/core/events.py +123 -123
- package/core/file_mentions.py +280 -280
- package/core/interaction.py +411 -411
- package/core/loop.py +2566 -2566
- package/core/memory.py +482 -482
- package/core/pipeline_models.py +190 -190
- package/core/provider_errors.py +274 -234
- package/core/reasoning/authorization.py +130 -130
- package/core/reasoning/base.py +219 -219
- package/core/reasoning/confidence_scoring.py +484 -484
- package/core/reasoning/events.py +149 -149
- package/core/reasoning/orchestrator.py +1561 -1561
- package/core/reasoning/output_writer.py +345 -345
- package/core/reasoning/payload_validation.py +524 -524
- package/core/reasoning/pipeline_storage.py +427 -427
- package/core/reasoning/scholar.py +467 -458
- package/core/reasoning/source_corpus.py +433 -433
- package/core/reasoning/source_scoring.py +855 -855
- package/core/replay.py +315 -315
- package/core/shell_sessions.py +1553 -1553
- package/credentials.py +307 -307
- package/database.py +333 -333
- package/docs/PRIVACY.md +78 -78
- package/docs/SECURITY.md +114 -108
- package/docs/THIRD_PARTY_NOTICES.md +148 -148
- package/env_secrets.py +118 -118
- package/json_store.py +343 -343
- package/logging_setup.py +295 -295
- package/main.py +3433 -3433
- package/mcp_client/client.py +780 -733
- package/mcp_client/config.py +484 -484
- package/mcp_client/registration.py +343 -343
- package/memories/manager.py +147 -147
- package/memories/tui_commands.py +319 -239
- package/package.json +303 -303
- package/project_init/config_files.py +282 -282
- package/project_init/generator.py +728 -728
- package/project_init/manifest.py +418 -418
- package/project_init/tui_commands.py +147 -147
- package/prompts/critic_pass.md +24 -24
- package/prompts/revalidate.md +25 -25
- package/prompts/revise.md +17 -17
- package/prompts/source_grounding.md +66 -66
- package/prompts/system_prompts.py +316 -316
- package/providers.json.example +94 -94
- package/pyproject.toml +149 -149
- package/requirements.txt +314 -295
- package/safety/policy_enforcement.py +1082 -1082
- package/security/askpass.py +419 -419
- package/security/capability.py +207 -207
- package/security/confine.py +484 -484
- package/security/hosted.py +182 -182
- package/security/permissions.py +237 -237
- package/security/protected_paths.py +501 -501
- package/security/sandbox.py +4108 -4108
- package/skills/builtin/math/formal-specification.md +67 -67
- package/skills/builtin/math/numerical-methods.md +66 -66
- package/skills/builtin/research/experiment-design.md +62 -62
- package/skills/builtin/research/reproducibility.md +55 -55
- package/skills/builtin/research/source-evaluation.md +70 -70
- package/skills/builtin/research/statistical-inference.md +63 -63
- package/skills/builtin/research/technical-writing.md +59 -59
- package/skills/builtin/software/code-review.md +61 -61
- package/skills/builtin/software/debugging.md +61 -61
- package/skills/builtin/software/test-design.md +67 -67
- package/skills/tui_commands.py +110 -110
- package/storage.py +1338 -1338
- package/tools/base.py +465 -465
- package/tools/builtin/_math_common.py +667 -667
- package/tools/builtin/_net_common.py +1145 -267
- package/tools/builtin/_page_text.py +490 -0
- package/tools/builtin/_pdf_text.py +113 -0
- package/tools/builtin/arxiv.py +685 -681
- package/tools/builtin/fetch_url.py +639 -371
- package/tools/builtin/file_ops.py +720 -720
- package/tools/builtin/geometry.py +184 -184
- package/tools/builtin/load_skill.py +76 -76
- package/tools/builtin/pin.py +227 -227
- package/tools/builtin/probability_stats.py +224 -224
- package/tools/builtin/project_docs.py +464 -464
- package/tools/builtin/remember.py +175 -175
- package/tools/builtin/shell.py +980 -980
- package/tools/builtin/todo.py +149 -149
- package/tools/builtin/web_search.py +402 -328
- package/tools/context.py +159 -159
- package/tools/isolation.py +387 -387
- package/tools/registry.py +1252 -1242
- package/tui/app.py +8372 -8307
- package/tui/app.tcss +754 -739
- package/tui/commands.py +26 -26
- package/tui/diffs.py +286 -286
- package/tui/history.py +128 -128
- package/tui/hosted_driver.py +102 -102
- package/tui/markdown.py +1329 -1329
- package/tui/meters.py +364 -364
- package/tui/ravens.py +146 -146
- package/tui/screens.py +1255 -1197
- package/tui/themes.py +599 -599
- package/tui/widgets.py +3861 -3796
|
@@ -1,175 +1,175 @@
|
|
|
1
|
-
"""
|
|
2
|
-
tools/builtin/remember.py
|
|
3
|
-
|
|
4
|
-
ROADMAP_v2 §21b: write a durable fact that outlives this conversation.
|
|
5
|
-
|
|
6
|
-
APPROVAL-GATED (D26), and the asymmetry with `pin` is the decision rather
|
|
7
|
-
than an oversight. They differ on the axis that already separates `read`
|
|
8
|
-
from `write`: a pin is thread-scoped, reversible, and takes effect inside a
|
|
9
|
-
conversation the user is watching, so a wrong one costs some context budget
|
|
10
|
-
and nothing else. A memory outlives the thread and silently shapes
|
|
11
|
-
conversations the user has not started yet -- persistent, and invisible at
|
|
12
|
-
the moment it actually matters.
|
|
13
|
-
|
|
14
|
-
Two consequences §21 names rather than leaves to be discovered:
|
|
15
|
-
|
|
16
|
-
* It cannot fire on a headless path. With no permission channel and no
|
|
17
|
-
ApprovalProvider, §13 does not merely deny an approval-gated tool -- it
|
|
18
|
-
stops advertising it. Every research pass is such a path, and that is
|
|
19
|
-
the right outcome: a ten-pass pipeline reading fetched web pages is
|
|
20
|
-
exactly where an injected "remember this" would be most dangerous and
|
|
21
|
-
least noticed. §21b's CLI provider (M16) is what makes the tool
|
|
22
|
-
reachable in the default shell, and nothing makes it reachable in the
|
|
23
|
-
pipeline -- its ToolSpec declares grant_policy=GRANT_NEVER (M17,
|
|
24
|
-
carried by R13), which also keeps it out of §18's subagent sign-off.
|
|
25
|
-
* If the prompt turns out to fire too often, the answer is to make the
|
|
26
|
-
write VISIBLE AND UNDOABLE, not to drop the gate. An approval prompt
|
|
27
|
-
dismissed reflexively launders consent. `/forget` and `/memories` ship
|
|
28
|
-
with this section for the separate reason that a memory can go stale.
|
|
29
|
-
|
|
30
|
-
SCOPE DEFAULTS TO "project" (D25). The two error directions are not
|
|
31
|
-
symmetric: a memory that should have been project-scoped but landed
|
|
32
|
-
globally contaminates every later conversation with a stale fact about a
|
|
33
|
-
codebase you may not be working in, and presents as the model simply being
|
|
34
|
-
confident. One that should have been global merely fails to appear
|
|
35
|
-
somewhere useful, and the fix is to say it again.
|
|
36
|
-
"""
|
|
37
|
-
|
|
38
|
-
import config
|
|
39
|
-
|
|
40
|
-
TOOL_SCHEMA = {
|
|
41
|
-
"name": "remember",
|
|
42
|
-
"description": (
|
|
43
|
-
"Save a fact so it is still available in future conversations. Use "
|
|
44
|
-
"this for things that stay true and would be tedious to re-establish "
|
|
45
|
-
"-- a project's conventions, a decision and its reason, a constraint "
|
|
46
|
-
"the user stated once. Do NOT use it for anything specific to the "
|
|
47
|
-
"task at hand, which the current conversation already carries. "
|
|
48
|
-
"Scope defaults to this project. Use scope='global' only for durable "
|
|
49
|
-
"preferences about how the user wants to work ('prefers concise "
|
|
50
|
-
"answers', 'wants tests before implementation') -- facts about a "
|
|
51
|
-
"particular codebase are not global. The user is asked to approve "
|
|
52
|
-
"every memory before it is written."
|
|
53
|
-
),
|
|
54
|
-
"input_schema": {
|
|
55
|
-
"type": "object",
|
|
56
|
-
"properties": {
|
|
57
|
-
"content": {
|
|
58
|
-
"type": "string",
|
|
59
|
-
"description": "The fact, stated so it still makes sense "
|
|
60
|
-
"months later with no surrounding "
|
|
61
|
-
"conversation. Prefer one sentence.",
|
|
62
|
-
},
|
|
63
|
-
"scope": {
|
|
64
|
-
"type": "string",
|
|
65
|
-
"enum": ["project", "global"],
|
|
66
|
-
"description": "'project' (default) for facts about this "
|
|
67
|
-
"codebase; 'global' for how the user likes "
|
|
68
|
-
"to work.",
|
|
69
|
-
"default": "project",
|
|
70
|
-
},
|
|
71
|
-
"category": {
|
|
72
|
-
"type": "string",
|
|
73
|
-
"description": "Optional free-text grouping, e.g. 'tooling' "
|
|
74
|
-
"or 'conventions'.",
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
"required": ["content"],
|
|
78
|
-
},
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
_SCOPES = ("project", "global")
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def _scope(params: dict):
|
|
85
|
-
"""The scope asked for, with an explicit null read as ABSENT (batch 190).
|
|
86
|
-
|
|
87
|
-
The ChatGPT plan's model sends each optional parameter at its declared
|
|
88
|
-
default (ROADMAP_v3 §83, the owner's live check), so the schema now
|
|
89
|
-
declares 'project'; a model that sends null instead means the same
|
|
90
|
-
thing, and refusing it cost a turn. Anything else -- an empty string
|
|
91
|
-
included -- is the caller's own answer, checked against _SCOPES and never
|
|
92
|
-
coerced (see `run`).
|
|
93
|
-
"""
|
|
94
|
-
scope = params.get("scope")
|
|
95
|
-
return "project" if scope is None else scope
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def approval_notice(params: dict, context) -> str:
|
|
99
|
-
"""What the approval prompt shows before the write.
|
|
100
|
-
|
|
101
|
-
THE GATE IS ONLY WORTH HAVING IF THE PROMPT SHOWS WHAT IT IS GATING.
|
|
102
|
-
"remember wants to run" tells the user nothing they can act on; the
|
|
103
|
-
content, verbatim, and how far it will reach is the whole decision.
|
|
104
|
-
This is also why §21b adds no separate "— remembered —" marker: the
|
|
105
|
-
user has already seen the exact text, BEFORE it was written, which is
|
|
106
|
-
strictly better than a confirmation afterwards.
|
|
107
|
-
"""
|
|
108
|
-
from memories.manager import manager
|
|
109
|
-
|
|
110
|
-
scope = _scope(params)
|
|
111
|
-
where = ("every future conversation, in any project"
|
|
112
|
-
if scope == "global"
|
|
113
|
-
else f"future conversations in {manager.scope_path() or 'this project'}")
|
|
114
|
-
return f"Will remember, for {where}:\n {params.get('content', '')!r}"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def run(params: dict, memory=None) -> dict:
|
|
118
|
-
# params.get, not params[]: no provider validates tool inputs against
|
|
119
|
-
# the schema. tools/base.py carries the one copy of why, under
|
|
120
|
-
# "WHAT A CALLABLE REGISTERED BELOW MAY RAISE": a handler's exception IS
|
|
121
|
-
# contained, so what this buys is an error dict the model can READ rather
|
|
122
|
-
# than the generic wrapper dispatch() would return (batch 146).
|
|
123
|
-
from memories.manager import manager
|
|
124
|
-
from storage import save_memory
|
|
125
|
-
|
|
126
|
-
content = (params.get("content") or "").strip()
|
|
127
|
-
if not content:
|
|
128
|
-
return {"error": "remember requires 'content' -- the fact to save."}
|
|
129
|
-
|
|
130
|
-
scope = _scope(params)
|
|
131
|
-
if scope not in _SCOPES:
|
|
132
|
-
# Not silently coerced to the default. A model asking for "global"
|
|
133
|
-
# and getting a project row would believe a preference follows the
|
|
134
|
-
# user everywhere when it does not.
|
|
135
|
-
return {"error": f"remember: scope must be one of "
|
|
136
|
-
f"{', '.join(_SCOPES)}, got {scope!r}."}
|
|
137
|
-
|
|
138
|
-
project_path = manager.scope_path()
|
|
139
|
-
if scope == "project" and project_path is None:
|
|
140
|
-
# No project has been resolved, so a "project" memory has nothing
|
|
141
|
-
# to be keyed to and would be invisible to every later session
|
|
142
|
-
# (list_memories matches on the path). Saying so beats writing a
|
|
143
|
-
# row that can never be read.
|
|
144
|
-
return {"error": "remember: no project directory has been resolved, "
|
|
145
|
-
"so a project-scoped memory could never be found "
|
|
146
|
-
"again. Use scope='global' if this should follow "
|
|
147
|
-
"the user everywhere."}
|
|
148
|
-
if memory is None:
|
|
149
|
-
# Reachable only if dispatched outside a run. A memory with no
|
|
150
|
-
# source thread loses the one piece of provenance it has.
|
|
151
|
-
return {"error": "remember is only available inside a conversation."}
|
|
152
|
-
|
|
153
|
-
save_memory(
|
|
154
|
-
content=content,
|
|
155
|
-
source_thread_id=memory.thread_id,
|
|
156
|
-
scope=scope,
|
|
157
|
-
category=params.get("category"),
|
|
158
|
-
project_path=project_path,
|
|
159
|
-
)
|
|
160
|
-
where = "everywhere" if scope == "global" else "this project"
|
|
161
|
-
return {"result": f"Remembered ({where}): {content}"}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
def available() -> bool:
|
|
165
|
-
"""ToolSpec.available_check.
|
|
166
|
-
|
|
167
|
-
Hidden when nothing would ever read a memory back. Writing one the
|
|
168
|
-
harness will not inject is the fetch_url defect shape (D24): a schema
|
|
169
|
-
the model can see, choose, and never get value from.
|
|
170
|
-
|
|
171
|
-
In practice this is only False before config_loader.initialize(), which
|
|
172
|
-
is why it is cheap -- but it also keeps the tool honest if a future
|
|
173
|
-
configuration turns injection off wholesale.
|
|
174
|
-
"""
|
|
175
|
-
return config.MAX_INJECTED_MEMORIES > 0
|
|
1
|
+
"""
|
|
2
|
+
tools/builtin/remember.py
|
|
3
|
+
|
|
4
|
+
ROADMAP_v2 §21b: write a durable fact that outlives this conversation.
|
|
5
|
+
|
|
6
|
+
APPROVAL-GATED (D26), and the asymmetry with `pin` is the decision rather
|
|
7
|
+
than an oversight. They differ on the axis that already separates `read`
|
|
8
|
+
from `write`: a pin is thread-scoped, reversible, and takes effect inside a
|
|
9
|
+
conversation the user is watching, so a wrong one costs some context budget
|
|
10
|
+
and nothing else. A memory outlives the thread and silently shapes
|
|
11
|
+
conversations the user has not started yet -- persistent, and invisible at
|
|
12
|
+
the moment it actually matters.
|
|
13
|
+
|
|
14
|
+
Two consequences §21 names rather than leaves to be discovered:
|
|
15
|
+
|
|
16
|
+
* It cannot fire on a headless path. With no permission channel and no
|
|
17
|
+
ApprovalProvider, §13 does not merely deny an approval-gated tool -- it
|
|
18
|
+
stops advertising it. Every research pass is such a path, and that is
|
|
19
|
+
the right outcome: a ten-pass pipeline reading fetched web pages is
|
|
20
|
+
exactly where an injected "remember this" would be most dangerous and
|
|
21
|
+
least noticed. §21b's CLI provider (M16) is what makes the tool
|
|
22
|
+
reachable in the default shell, and nothing makes it reachable in the
|
|
23
|
+
pipeline -- its ToolSpec declares grant_policy=GRANT_NEVER (M17,
|
|
24
|
+
carried by R13), which also keeps it out of §18's subagent sign-off.
|
|
25
|
+
* If the prompt turns out to fire too often, the answer is to make the
|
|
26
|
+
write VISIBLE AND UNDOABLE, not to drop the gate. An approval prompt
|
|
27
|
+
dismissed reflexively launders consent. `/forget` and `/memories` ship
|
|
28
|
+
with this section for the separate reason that a memory can go stale.
|
|
29
|
+
|
|
30
|
+
SCOPE DEFAULTS TO "project" (D25). The two error directions are not
|
|
31
|
+
symmetric: a memory that should have been project-scoped but landed
|
|
32
|
+
globally contaminates every later conversation with a stale fact about a
|
|
33
|
+
codebase you may not be working in, and presents as the model simply being
|
|
34
|
+
confident. One that should have been global merely fails to appear
|
|
35
|
+
somewhere useful, and the fix is to say it again.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
import config
|
|
39
|
+
|
|
40
|
+
TOOL_SCHEMA = {
|
|
41
|
+
"name": "remember",
|
|
42
|
+
"description": (
|
|
43
|
+
"Save a fact so it is still available in future conversations. Use "
|
|
44
|
+
"this for things that stay true and would be tedious to re-establish "
|
|
45
|
+
"-- a project's conventions, a decision and its reason, a constraint "
|
|
46
|
+
"the user stated once. Do NOT use it for anything specific to the "
|
|
47
|
+
"task at hand, which the current conversation already carries. "
|
|
48
|
+
"Scope defaults to this project. Use scope='global' only for durable "
|
|
49
|
+
"preferences about how the user wants to work ('prefers concise "
|
|
50
|
+
"answers', 'wants tests before implementation') -- facts about a "
|
|
51
|
+
"particular codebase are not global. The user is asked to approve "
|
|
52
|
+
"every memory before it is written."
|
|
53
|
+
),
|
|
54
|
+
"input_schema": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"content": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "The fact, stated so it still makes sense "
|
|
60
|
+
"months later with no surrounding "
|
|
61
|
+
"conversation. Prefer one sentence.",
|
|
62
|
+
},
|
|
63
|
+
"scope": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"enum": ["project", "global"],
|
|
66
|
+
"description": "'project' (default) for facts about this "
|
|
67
|
+
"codebase; 'global' for how the user likes "
|
|
68
|
+
"to work.",
|
|
69
|
+
"default": "project",
|
|
70
|
+
},
|
|
71
|
+
"category": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Optional free-text grouping, e.g. 'tooling' "
|
|
74
|
+
"or 'conventions'.",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
"required": ["content"],
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_SCOPES = ("project", "global")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _scope(params: dict):
|
|
85
|
+
"""The scope asked for, with an explicit null read as ABSENT (batch 190).
|
|
86
|
+
|
|
87
|
+
The ChatGPT plan's model sends each optional parameter at its declared
|
|
88
|
+
default (ROADMAP_v3 §83, the owner's live check), so the schema now
|
|
89
|
+
declares 'project'; a model that sends null instead means the same
|
|
90
|
+
thing, and refusing it cost a turn. Anything else -- an empty string
|
|
91
|
+
included -- is the caller's own answer, checked against _SCOPES and never
|
|
92
|
+
coerced (see `run`).
|
|
93
|
+
"""
|
|
94
|
+
scope = params.get("scope")
|
|
95
|
+
return "project" if scope is None else scope
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def approval_notice(params: dict, context) -> str:
|
|
99
|
+
"""What the approval prompt shows before the write.
|
|
100
|
+
|
|
101
|
+
THE GATE IS ONLY WORTH HAVING IF THE PROMPT SHOWS WHAT IT IS GATING.
|
|
102
|
+
"remember wants to run" tells the user nothing they can act on; the
|
|
103
|
+
content, verbatim, and how far it will reach is the whole decision.
|
|
104
|
+
This is also why §21b adds no separate "— remembered —" marker: the
|
|
105
|
+
user has already seen the exact text, BEFORE it was written, which is
|
|
106
|
+
strictly better than a confirmation afterwards.
|
|
107
|
+
"""
|
|
108
|
+
from memories.manager import manager
|
|
109
|
+
|
|
110
|
+
scope = _scope(params)
|
|
111
|
+
where = ("every future conversation, in any project"
|
|
112
|
+
if scope == "global"
|
|
113
|
+
else f"future conversations in {manager.scope_path() or 'this project'}")
|
|
114
|
+
return f"Will remember, for {where}:\n {params.get('content', '')!r}"
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def run(params: dict, memory=None) -> dict:
|
|
118
|
+
# params.get, not params[]: no provider validates tool inputs against
|
|
119
|
+
# the schema. tools/base.py carries the one copy of why, under
|
|
120
|
+
# "WHAT A CALLABLE REGISTERED BELOW MAY RAISE": a handler's exception IS
|
|
121
|
+
# contained, so what this buys is an error dict the model can READ rather
|
|
122
|
+
# than the generic wrapper dispatch() would return (batch 146).
|
|
123
|
+
from memories.manager import manager
|
|
124
|
+
from storage import save_memory
|
|
125
|
+
|
|
126
|
+
content = (params.get("content") or "").strip()
|
|
127
|
+
if not content:
|
|
128
|
+
return {"error": "remember requires 'content' -- the fact to save."}
|
|
129
|
+
|
|
130
|
+
scope = _scope(params)
|
|
131
|
+
if scope not in _SCOPES:
|
|
132
|
+
# Not silently coerced to the default. A model asking for "global"
|
|
133
|
+
# and getting a project row would believe a preference follows the
|
|
134
|
+
# user everywhere when it does not.
|
|
135
|
+
return {"error": f"remember: scope must be one of "
|
|
136
|
+
f"{', '.join(_SCOPES)}, got {scope!r}."}
|
|
137
|
+
|
|
138
|
+
project_path = manager.scope_path()
|
|
139
|
+
if scope == "project" and project_path is None:
|
|
140
|
+
# No project has been resolved, so a "project" memory has nothing
|
|
141
|
+
# to be keyed to and would be invisible to every later session
|
|
142
|
+
# (list_memories matches on the path). Saying so beats writing a
|
|
143
|
+
# row that can never be read.
|
|
144
|
+
return {"error": "remember: no project directory has been resolved, "
|
|
145
|
+
"so a project-scoped memory could never be found "
|
|
146
|
+
"again. Use scope='global' if this should follow "
|
|
147
|
+
"the user everywhere."}
|
|
148
|
+
if memory is None:
|
|
149
|
+
# Reachable only if dispatched outside a run. A memory with no
|
|
150
|
+
# source thread loses the one piece of provenance it has.
|
|
151
|
+
return {"error": "remember is only available inside a conversation."}
|
|
152
|
+
|
|
153
|
+
save_memory(
|
|
154
|
+
content=content,
|
|
155
|
+
source_thread_id=memory.thread_id,
|
|
156
|
+
scope=scope,
|
|
157
|
+
category=params.get("category"),
|
|
158
|
+
project_path=project_path,
|
|
159
|
+
)
|
|
160
|
+
where = "everywhere" if scope == "global" else "this project"
|
|
161
|
+
return {"result": f"Remembered ({where}): {content}"}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def available() -> bool:
|
|
165
|
+
"""ToolSpec.available_check.
|
|
166
|
+
|
|
167
|
+
Hidden when nothing would ever read a memory back. Writing one the
|
|
168
|
+
harness will not inject is the fetch_url defect shape (D24): a schema
|
|
169
|
+
the model can see, choose, and never get value from.
|
|
170
|
+
|
|
171
|
+
In practice this is only False before config_loader.initialize(), which
|
|
172
|
+
is why it is cheap -- but it also keeps the tool honest if a future
|
|
173
|
+
configuration turns injection off wholesale.
|
|
174
|
+
"""
|
|
175
|
+
return config.MAX_INJECTED_MEMORIES > 0
|