@yahyahammad/venastine 0.1.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/.env.example +14 -0
- package/LICENSE +201 -0
- package/NOTICE +14 -0
- package/PRIVACY.md +66 -0
- package/README.md +878 -0
- package/SECURITY.md +88 -0
- package/THIRD_PARTY_NOTICES.md +100 -0
- package/agents/builtin/compactor.md +75 -0
- package/agents/builtin/explore.md +77 -0
- package/agents/builtin/grill-me.md +27 -0
- package/agents/builtin/initializer.md +94 -0
- package/agents/builtin/pipeline-reviewer.md +100 -0
- package/agents/builtin/plan.md +88 -0
- package/agents/builtin/review.md +74 -0
- package/agents/manager.py +195 -0
- package/agents/subagent_tool.py +215 -0
- package/agents/tui_commands.py +136 -0
- package/bin/venastine.mjs +382 -0
- package/config.py +1198 -0
- package/core/__init__.py +0 -0
- package/core/approval.py +115 -0
- package/core/client.py +1548 -0
- package/core/compaction.py +959 -0
- package/core/config_loader.py +1563 -0
- package/core/events.py +61 -0
- package/core/interaction.py +328 -0
- package/core/loop.py +1353 -0
- package/core/memory.py +370 -0
- package/core/model_windows.py +175 -0
- package/core/pipeline_models.py +176 -0
- package/core/reasoning/__init__.py +0 -0
- package/core/reasoning/authorization.py +130 -0
- package/core/reasoning/base.py +219 -0
- package/core/reasoning/confidence_scoring.py +468 -0
- package/core/reasoning/events.py +149 -0
- package/core/reasoning/json_retry.py +219 -0
- package/core/reasoning/orchestrator.py +1382 -0
- package/core/reasoning/output_writer.py +286 -0
- package/core/reasoning/payload_validation.py +398 -0
- package/core/reasoning/pipeline_storage.py +361 -0
- package/core/reasoning/review.py +615 -0
- package/core/reasoning/scholar.py +434 -0
- package/core/reasoning/source_corpus.py +327 -0
- package/core/reasoning/source_scoring.py +855 -0
- package/core/replay.py +167 -0
- package/core/session.py +153 -0
- package/core/workspace_trust.py +207 -0
- package/credentials.py +180 -0
- package/database.py +252 -0
- package/env_secrets.py +77 -0
- package/json_store.py +123 -0
- package/logging_setup.py +185 -0
- package/main.py +1959 -0
- package/mcp_client/__init__.py +15 -0
- package/mcp_client/client.py +499 -0
- package/mcp_client/config.py +379 -0
- package/mcp_client/registration.py +182 -0
- package/memories/manager.py +132 -0
- package/memories/tui_commands.py +232 -0
- package/package.json +73 -0
- package/project_init/config_files.py +278 -0
- package/project_init/doc_sets.py +330 -0
- package/project_init/generator.py +564 -0
- package/project_init/manifest.py +406 -0
- package/project_init/tui_commands.py +144 -0
- package/prompts/__init__.py +0 -0
- package/prompts/annotate.md +14 -0
- package/prompts/assumption_audit.md +27 -0
- package/prompts/claim_extraction.md +34 -0
- package/prompts/completeness.md +18 -0
- package/prompts/confidence_tiers.md +23 -0
- package/prompts/critic_pass.md +24 -0
- package/prompts/final_synthesis.md +13 -0
- package/prompts/initial_generation.md +14 -0
- package/prompts/preliminary_plan.md +23 -0
- package/prompts/revalidate.md +25 -0
- package/prompts/revise.md +15 -0
- package/prompts/source_grounding.md +66 -0
- package/prompts/system_prompts.py +262 -0
- package/prompts/universal_system_prompt +7 -0
- package/prompts/untrusted_content +1 -0
- package/providers.json.example +92 -0
- package/pyproject.toml +100 -0
- package/requirements.txt +72 -0
- package/safety/__init__.py +0 -0
- package/safety/policy_enforcement.py +682 -0
- package/security/__init__.py +0 -0
- package/security/capability.py +177 -0
- package/security/permissions.py +190 -0
- package/security/posture.py +302 -0
- package/security/protected_paths.py +309 -0
- package/security/sandbox.py +985 -0
- package/skills/builtin/crypto/cryptography-verification.md +66 -0
- package/skills/builtin/math/formal-specification.md +67 -0
- package/skills/builtin/math/numerical-methods.md +66 -0
- package/skills/builtin/math/proof-writing.md +61 -0
- package/skills/builtin/research/experiment-design.md +62 -0
- package/skills/builtin/research/literature-review.md +65 -0
- package/skills/builtin/research/reproducibility.md +55 -0
- package/skills/builtin/research/source-evaluation.md +70 -0
- package/skills/builtin/research/statistical-inference.md +63 -0
- package/skills/builtin/research/technical-writing.md +59 -0
- package/skills/builtin/security/cybersecurity-research.md +63 -0
- package/skills/builtin/software/code-review.md +61 -0
- package/skills/builtin/software/debugging.md +61 -0
- package/skills/builtin/software/test-design.md +67 -0
- package/skills/manager.py +138 -0
- package/skills/tui_commands.py +111 -0
- package/storage.py +1005 -0
- package/tools/base.py +305 -0
- package/tools/builtin/__init__.py +0 -0
- package/tools/builtin/_math_common.py +377 -0
- package/tools/builtin/_net_common.py +61 -0
- package/tools/builtin/arxiv.py +223 -0
- package/tools/builtin/ask_user.py +213 -0
- package/tools/builtin/discrete_math.py +134 -0
- package/tools/builtin/fetch_url.py +153 -0
- package/tools/builtin/file_ops.py +412 -0
- package/tools/builtin/geometry.py +148 -0
- package/tools/builtin/get_time.py +20 -0
- package/tools/builtin/linear_algebra.py +155 -0
- package/tools/builtin/load_skill.py +66 -0
- package/tools/builtin/logic.py +96 -0
- package/tools/builtin/pin.py +193 -0
- package/tools/builtin/probability_stats.py +228 -0
- package/tools/builtin/project_docs.py +405 -0
- package/tools/builtin/remember.py +158 -0
- package/tools/builtin/shell.py +461 -0
- package/tools/builtin/symbolic_math.py +119 -0
- package/tools/builtin/todo.py +147 -0
- package/tools/builtin/web_search.py +151 -0
- package/tools/context.py +136 -0
- package/tools/isolation.py +314 -0
- package/tools/registry.py +897 -0
- package/tui/app.py +3423 -0
- package/tui/app.tcss +458 -0
- package/tui/commands.py +61 -0
- package/tui/diffs.py +265 -0
- package/tui/preferences.py +182 -0
- package/tui/ravens.py +146 -0
- package/tui/screens.py +943 -0
- package/tui/themes.py +366 -0
- package/tui/widgets.py +1239 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""
|
|
2
|
+
memories/manager.py
|
|
3
|
+
|
|
4
|
+
ROADMAP_v2 §21b. Durable memory: what is in scope for this session, how
|
|
5
|
+
much of it reaches a prompt, and the one place that text is assembled.
|
|
6
|
+
|
|
7
|
+
Mirrors skills/manager.py deliberately -- a manager over rows the loader
|
|
8
|
+
does not own, holding no session state, plus a single prompt_fragment().
|
|
9
|
+
A package rather than a module under core/ because `core/memory.py`
|
|
10
|
+
already means the in-run conversation state, and two names that close
|
|
11
|
+
together is a trap rather than a convention.
|
|
12
|
+
|
|
13
|
+
WHAT THIS OWNS
|
|
14
|
+
scope resolution -- which rows this session may see (D25/M12)
|
|
15
|
+
the injection cap -- how many of them reach a prompt (M14)
|
|
16
|
+
prompt_fragment() -- the text, assembled once
|
|
17
|
+
|
|
18
|
+
WHAT IT DOES NOT OWN
|
|
19
|
+
Persistence (storage.py), the decision to write one (the `remember`
|
|
20
|
+
tool plus D26's approval gate), and WHERE the fragment is appended --
|
|
21
|
+
which is agents/manager.py for an agent run and the shells for a plain
|
|
22
|
+
chat turn.
|
|
23
|
+
|
|
24
|
+
THE FRAGMENT MUST BE APPENDED OUTSIDE with_catalogs() (M13). That function
|
|
25
|
+
feeds prompts.system_prompts.pass_prompt(), so injecting there would put
|
|
26
|
+
every durable memory into all ten research passes -- a run the user
|
|
27
|
+
started separately, from a shell that wrote none of them. This is the same
|
|
28
|
+
trap §19 recorded as K6 for skill bodies, and this is its second instance.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
import logging
|
|
32
|
+
from typing import Optional
|
|
33
|
+
|
|
34
|
+
import config
|
|
35
|
+
from core import config_loader
|
|
36
|
+
|
|
37
|
+
logger = logging.getLogger(__name__)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class MemoryManager:
|
|
41
|
+
"""Scope resolution and prompt assembly over storage's UserMemory rows."""
|
|
42
|
+
|
|
43
|
+
@staticmethod
|
|
44
|
+
def scope_path() -> Optional[str]:
|
|
45
|
+
"""The project path memories are scoped to this session, or None.
|
|
46
|
+
|
|
47
|
+
One resolution point, over config_loader's already-resolved value,
|
|
48
|
+
so "which project" cannot mean one thing to the trust store and
|
|
49
|
+
another to memory (D25).
|
|
50
|
+
"""
|
|
51
|
+
return config_loader.get_project_path()
|
|
52
|
+
|
|
53
|
+
def visible(self, scope: Optional[str] = None) -> list:
|
|
54
|
+
"""Every memory this session may see, newest first.
|
|
55
|
+
|
|
56
|
+
Global rows plus the project rows recorded against exactly this
|
|
57
|
+
path (§21 AC6).
|
|
58
|
+
|
|
59
|
+
NO RESOLVED PROJECT MEANS NO MEMORIES AT ALL, not global-only.
|
|
60
|
+
scope_path() is None exactly when config_loader.initialize() has
|
|
61
|
+
not run, and main.py runs it at startup -- so this is "there is no
|
|
62
|
+
session", not "this session happens to be outside a project". It
|
|
63
|
+
follows the convention get_agents()/get_skills() already set:
|
|
64
|
+
uninitialized is materially the same state as initialized-and-empty
|
|
65
|
+
for every consumer, and answering with rows would mean reading a
|
|
66
|
+
database on behalf of a session that does not exist.
|
|
67
|
+
"""
|
|
68
|
+
from storage import list_memories
|
|
69
|
+
|
|
70
|
+
path = self.scope_path()
|
|
71
|
+
if path is None:
|
|
72
|
+
return []
|
|
73
|
+
return list_memories(project_path=path, scope=scope)
|
|
74
|
+
|
|
75
|
+
def wants_memories(self, agent) -> bool:
|
|
76
|
+
"""Does this run get memories injected?
|
|
77
|
+
|
|
78
|
+
M13: `agent=None` -- a plain chat turn with no active agent -- counts
|
|
79
|
+
as opted IN. The frontmatter parser already defaults `use_memory` to
|
|
80
|
+
True, so an agent that says nothing gets them, and treating "no agent
|
|
81
|
+
at all" differently would make the whole feature invisible in the
|
|
82
|
+
default shell until someone happened to run /agent. That is the §25
|
|
83
|
+
shape: a capability a whole shell cannot reach.
|
|
84
|
+
|
|
85
|
+
`use_memory: false` still opts out, which is how the compactor and
|
|
86
|
+
the pipeline reviewer stay out of it.
|
|
87
|
+
"""
|
|
88
|
+
return agent is None or bool(getattr(agent, "use_memory", True))
|
|
89
|
+
|
|
90
|
+
def prompt_fragment(self, agent=None) -> str:
|
|
91
|
+
"""The `## Remembered` block for this session, or "".
|
|
92
|
+
|
|
93
|
+
ONE assembly point, mirroring skills.manager.prompt_fragment and
|
|
94
|
+
core.loop.with_goal, so every shell that injects memories produces
|
|
95
|
+
the same text.
|
|
96
|
+
|
|
97
|
+
CAPPED, AND THE CAP IS STATED IN THE TEXT (M14). Every in-scope
|
|
98
|
+
memory would otherwise enter every turn forever, which is the
|
|
99
|
+
unbounded context growth §21 exists to fight. Newest first, because
|
|
100
|
+
recency is the only staleness signal available without asking a
|
|
101
|
+
model. The count is reported to the MODEL and not only to a log:
|
|
102
|
+
the model is the consumer, and one that can see it is looking at a
|
|
103
|
+
truncated list can say so, while a log line reaches nobody
|
|
104
|
+
mid-conversation. Same "no silent caps" rule as §20's
|
|
105
|
+
MAX_REVIEW_FINDINGS.
|
|
106
|
+
"""
|
|
107
|
+
if not self.wants_memories(agent):
|
|
108
|
+
return ""
|
|
109
|
+
rows = self.visible()
|
|
110
|
+
if not rows:
|
|
111
|
+
return ""
|
|
112
|
+
|
|
113
|
+
cap = config.MAX_INJECTED_MEMORIES
|
|
114
|
+
shown, total = rows[:cap], len(rows)
|
|
115
|
+
header = "## Remembered"
|
|
116
|
+
if total > cap:
|
|
117
|
+
logger.warning(
|
|
118
|
+
"Injecting %s of %s memories; the oldest %s are not in this "
|
|
119
|
+
"prompt. Raise config.MAX_INJECTED_MEMORIES or prune with "
|
|
120
|
+
"/forget.", cap, total, total - cap)
|
|
121
|
+
header = (f"{header}\n\nShowing the {cap} most recent of {total}. "
|
|
122
|
+
f"Older ones exist and are not listed here.")
|
|
123
|
+
|
|
124
|
+
lines = [header, ""]
|
|
125
|
+
for row in shown:
|
|
126
|
+
marker = "global" if row["scope"] == "global" else "this project"
|
|
127
|
+
category = f" [{row['category']}]" if row.get("category") else ""
|
|
128
|
+
lines.append(f"- ({marker}){category} {row['content']}")
|
|
129
|
+
return "\n".join(lines)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
manager = MemoryManager()
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"""
|
|
2
|
+
memories/tui_commands.py
|
|
3
|
+
|
|
4
|
+
ROADMAP_v2 §21b (M15): `/memories` and `/forget`, registered into §16's
|
|
5
|
+
slash registry. Mirrors skills/tui_commands.py and agents/tui_commands.py.
|
|
6
|
+
|
|
7
|
+
WHY THESE SHIP NOW rather than as D26's fallback. §21 frames `/forget` as
|
|
8
|
+
what to build *if* the approval prompt turns out to fire too often. But
|
|
9
|
+
staleness is a different problem the gate never touches: "we use React 17"
|
|
10
|
+
was true when it was approved and survives the upgrade regardless. Without
|
|
11
|
+
removal, one memory that stops being true is permanent -- and listing is
|
|
12
|
+
what makes removal usable at all, since the model never shows ids.
|
|
13
|
+
|
|
14
|
+
Reading is deliberately not model-callable. A `forget` tool would let the
|
|
15
|
+
model retire a memory it judged outdated, which is convenient and is also
|
|
16
|
+
a deletion capability that would need its own gate: D26's argument for
|
|
17
|
+
gating `remember` applies at least as strongly to silently removing
|
|
18
|
+
something the user relies on.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from uuid import UUID
|
|
22
|
+
|
|
23
|
+
from tui.commands import SlashCommand, registry as commands
|
|
24
|
+
from memories.manager import manager
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _cmd_memories(app, args: str) -> None:
|
|
28
|
+
"""List what this session can see, with ids for /forget."""
|
|
29
|
+
rows = manager.visible()
|
|
30
|
+
if not rows:
|
|
31
|
+
where = manager.scope_path() or "no project resolved"
|
|
32
|
+
app._transcript.write_system(
|
|
33
|
+
f"No durable memories visible here ({where}).")
|
|
34
|
+
return
|
|
35
|
+
app._transcript.write_system(f"{len(rows)} durable memories:")
|
|
36
|
+
for row in rows:
|
|
37
|
+
marker = "global" if row["scope"] == "global" else "project"
|
|
38
|
+
category = f" [{row['category']}]" if row.get("category") else ""
|
|
39
|
+
app._transcript.write_system(
|
|
40
|
+
f" {row['id']} ({marker}){category} {row['content']}")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _cmd_forget(app, args: str) -> None:
|
|
44
|
+
"""Delete one memory by id.
|
|
45
|
+
|
|
46
|
+
By ID and not by substring. A substring match that hit two memories
|
|
47
|
+
would have to pick one or refuse, and picking silently deletes
|
|
48
|
+
something the user did not name -- which is the one outcome a removal
|
|
49
|
+
command must never have.
|
|
50
|
+
"""
|
|
51
|
+
from storage import forget_memory
|
|
52
|
+
|
|
53
|
+
raw = args.strip()
|
|
54
|
+
if not raw:
|
|
55
|
+
app._transcript.write_error(
|
|
56
|
+
"Usage: /forget <id>. Run /memories to see the ids.")
|
|
57
|
+
return
|
|
58
|
+
try:
|
|
59
|
+
memory_id = UUID(raw)
|
|
60
|
+
except ValueError:
|
|
61
|
+
app._transcript.write_error(
|
|
62
|
+
f"Not a memory id: {raw!r}. Run /memories to see the ids.")
|
|
63
|
+
return
|
|
64
|
+
if forget_memory(memory_id):
|
|
65
|
+
app._transcript.write_system(f"Forgot {memory_id}.")
|
|
66
|
+
else:
|
|
67
|
+
app._transcript.write_error(f"No memory with id {memory_id}.")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _cmd_summary(app, args: str) -> None:
|
|
71
|
+
"""Distil this conversation and show the result (ROADMAP_v2 §21c).
|
|
72
|
+
|
|
73
|
+
DESCRIBES, DOES NOT FOLD (M20). `/compact` shortens what the model sees
|
|
74
|
+
next turn; this leaves the conversation exactly as it is and hands the
|
|
75
|
+
user a summary. Two different requests that happen to share a summarizer.
|
|
76
|
+
|
|
77
|
+
On a worker, because it is a model call, and announced before it starts:
|
|
78
|
+
a call the user pays for is never silent, the same rule /compact follows.
|
|
79
|
+
"""
|
|
80
|
+
if app._busy:
|
|
81
|
+
app._transcript.write_error(
|
|
82
|
+
"Still working — wait for this turn to finish.")
|
|
83
|
+
return
|
|
84
|
+
if app._memory is None:
|
|
85
|
+
app._transcript.write_error(
|
|
86
|
+
"Nothing to summarise — this thread is empty.")
|
|
87
|
+
return
|
|
88
|
+
|
|
89
|
+
memory = app.memory
|
|
90
|
+
app._busy = True
|
|
91
|
+
app._transcript.write_system("Summarising this conversation…")
|
|
92
|
+
|
|
93
|
+
def _work() -> None:
|
|
94
|
+
from core import compaction
|
|
95
|
+
try:
|
|
96
|
+
notice = compaction.summarize_thread(
|
|
97
|
+
memory.thread_id, app.model, app.provider_name)
|
|
98
|
+
except Exception as e: # noqa: BLE001 — same containment as /compact
|
|
99
|
+
app.call_from_thread(
|
|
100
|
+
app._transcript.write_error, f"Summary failed: {e}")
|
|
101
|
+
return
|
|
102
|
+
finally:
|
|
103
|
+
app.call_from_thread(setattr, app, "_busy", False)
|
|
104
|
+
if notice is None:
|
|
105
|
+
app.call_from_thread(
|
|
106
|
+
app._transcript.write_error,
|
|
107
|
+
"Could not summarise this thread.")
|
|
108
|
+
return
|
|
109
|
+
app.call_from_thread(app._transcript.write_system, "Summary:")
|
|
110
|
+
app.call_from_thread(app._transcript.write_answer, notice["text"])
|
|
111
|
+
|
|
112
|
+
app.run_worker(_work, thread=True, exit_on_error=False,
|
|
113
|
+
name="summary")
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _cmd_ref(app, args: str) -> None:
|
|
117
|
+
"""Attach another conversation's summary to this one (§21c).
|
|
118
|
+
|
|
119
|
+
USER-INITIATED BY CONSTRUCTION, which is §21's locked decision for this
|
|
120
|
+
feature rather than an implementation detail: the user picks what crosses
|
|
121
|
+
between threads, so nothing fetched or argued in one conversation can
|
|
122
|
+
steer another without their say-so. A model-callable `search_threads`
|
|
123
|
+
stays possible later, on this same retrieval and behind D26's gate.
|
|
124
|
+
"""
|
|
125
|
+
from core.loop import clear_refs
|
|
126
|
+
from tui.screens import ThreadPickerScreen
|
|
127
|
+
import storage
|
|
128
|
+
|
|
129
|
+
flag = args.strip().lower()
|
|
130
|
+
if flag in ("--list", "list"):
|
|
131
|
+
_write_ref_list(app)
|
|
132
|
+
return
|
|
133
|
+
if flag in ("--clear", "clear"):
|
|
134
|
+
if app._memory is None:
|
|
135
|
+
app._transcript.write_error("This thread references nothing.")
|
|
136
|
+
return
|
|
137
|
+
dropped = clear_refs(app.memory)
|
|
138
|
+
app._transcript.write_system(
|
|
139
|
+
f"Dropped {dropped} reference{'' if dropped == 1 else 's'}."
|
|
140
|
+
if dropped else "This thread references nothing.")
|
|
141
|
+
return
|
|
142
|
+
if flag:
|
|
143
|
+
app._transcript.write_error(
|
|
144
|
+
f"Unknown option {args.strip()!r}. Usage: /ref [--list|--clear].")
|
|
145
|
+
return
|
|
146
|
+
|
|
147
|
+
if app._busy:
|
|
148
|
+
app._transcript.write_error(
|
|
149
|
+
"Still working — wait for this turn to finish.")
|
|
150
|
+
return
|
|
151
|
+
|
|
152
|
+
current = app._memory.thread_id if app._memory is not None else None
|
|
153
|
+
# The CURRENT thread is excluded rather than merely discouraged:
|
|
154
|
+
# referencing yourself spends a model call to inject what the model is
|
|
155
|
+
# already reading.
|
|
156
|
+
threads = [t for t in storage.list_threads() if t["id"] != current]
|
|
157
|
+
if not threads:
|
|
158
|
+
app._transcript.write_system(
|
|
159
|
+
"No other conversations to reference yet.")
|
|
160
|
+
return
|
|
161
|
+
|
|
162
|
+
def chosen(thread_id) -> None:
|
|
163
|
+
if thread_id is None:
|
|
164
|
+
return
|
|
165
|
+
_attach_in_worker(app, thread_id, threads)
|
|
166
|
+
|
|
167
|
+
app.push_screen(ThreadPickerScreen(threads), chosen)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _write_ref_list(app) -> None:
|
|
171
|
+
refs = (app._memory.extra.get("refs") or []) if app._memory else []
|
|
172
|
+
if not refs:
|
|
173
|
+
app._transcript.write_system("This thread references nothing.")
|
|
174
|
+
return
|
|
175
|
+
app._transcript.write_system(f"Referencing {len(refs)} conversation(s):")
|
|
176
|
+
for ref in refs:
|
|
177
|
+
label = ref.get("label") or "(no preview)"
|
|
178
|
+
app._transcript.write_system(f" {ref['thread_id']} {label}")
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _attach_in_worker(app, thread_id, threads) -> None:
|
|
182
|
+
"""Summarise the chosen thread and attach it. On a worker: summarising is
|
|
183
|
+
a model call unless the stored summary is still current."""
|
|
184
|
+
from core import compaction
|
|
185
|
+
from core.loop import attach_ref
|
|
186
|
+
|
|
187
|
+
memory = app.memory
|
|
188
|
+
label = next((t.get("preview", "") for t in threads
|
|
189
|
+
if t["id"] == thread_id), "")
|
|
190
|
+
app._busy = True
|
|
191
|
+
app._transcript.write_system(f"Summarising thread {thread_id}…")
|
|
192
|
+
|
|
193
|
+
def _work() -> None:
|
|
194
|
+
try:
|
|
195
|
+
notice = compaction.summarize_thread(
|
|
196
|
+
thread_id, app.model, app.provider_name)
|
|
197
|
+
except Exception as e: # noqa: BLE001
|
|
198
|
+
app.call_from_thread(
|
|
199
|
+
app._transcript.write_error, f"Reference failed: {e}")
|
|
200
|
+
return
|
|
201
|
+
finally:
|
|
202
|
+
app.call_from_thread(setattr, app, "_busy", False)
|
|
203
|
+
if notice is None:
|
|
204
|
+
app.call_from_thread(
|
|
205
|
+
app._transcript.write_error,
|
|
206
|
+
f"Could not summarise thread {thread_id}.")
|
|
207
|
+
return
|
|
208
|
+
ok, message = attach_ref(memory, thread_id, notice["text"], label)
|
|
209
|
+
write = (app._transcript.write_system if ok
|
|
210
|
+
else app._transcript.write_error)
|
|
211
|
+
app.call_from_thread(write, message)
|
|
212
|
+
|
|
213
|
+
app.run_worker(_work, thread=True, exit_on_error=False, name="ref")
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def register_memory_commands() -> None:
|
|
217
|
+
"""Idempotent -- registering by name overwrites, matching §16's
|
|
218
|
+
register_builtin_commands(), §18's and §19's.
|
|
219
|
+
|
|
220
|
+
§21c's two live here with §21b's rather than in a module of their own:
|
|
221
|
+
they are the same section's family, and `/ref` reads what `/summary`
|
|
222
|
+
writes."""
|
|
223
|
+
commands.register(SlashCommand(
|
|
224
|
+
"memories", "list durable memories visible here", _cmd_memories))
|
|
225
|
+
commands.register(SlashCommand(
|
|
226
|
+
"forget", "delete one durable memory", _cmd_forget, "<id>"))
|
|
227
|
+
commands.register(SlashCommand(
|
|
228
|
+
"summary", "distil this conversation without folding it",
|
|
229
|
+
_cmd_summary))
|
|
230
|
+
commands.register(SlashCommand(
|
|
231
|
+
"ref", "reference another conversation's summary", _cmd_ref,
|
|
232
|
+
"[--list|--clear]"))
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yahyahammad/venastine",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A from-scratch agentic harness: tool-using chat plus a ten-pass self-critiquing research pipeline.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"llm",
|
|
8
|
+
"research",
|
|
9
|
+
"anthropic",
|
|
10
|
+
"openai",
|
|
11
|
+
"mcp"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/YahyaHammad/Venastine-Research-Harness#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/YahyaHammad/Venastine-Research-Harness/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/YahyaHammad/Venastine-Research-Harness.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"author": "Yahya Hammad",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"bin": {
|
|
25
|
+
"venastine": "bin/venastine.mjs"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"prepublishOnly": "node scripts/prepublish-check.mjs",
|
|
35
|
+
"check-pack": "node scripts/prepublish-check.mjs"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"bin/",
|
|
39
|
+
"main.py",
|
|
40
|
+
"config.py",
|
|
41
|
+
"storage.py",
|
|
42
|
+
"database.py",
|
|
43
|
+
"credentials.py",
|
|
44
|
+
"env_secrets.py",
|
|
45
|
+
"logging_setup.py",
|
|
46
|
+
"json_store.py",
|
|
47
|
+
"core/",
|
|
48
|
+
"tools/",
|
|
49
|
+
"tui/",
|
|
50
|
+
"agents/",
|
|
51
|
+
"skills/",
|
|
52
|
+
"prompts/",
|
|
53
|
+
"mcp_client/",
|
|
54
|
+
"security/",
|
|
55
|
+
"safety/",
|
|
56
|
+
"memories/",
|
|
57
|
+
"project_init/",
|
|
58
|
+
"requirements.txt",
|
|
59
|
+
"pyproject.toml",
|
|
60
|
+
"README.md",
|
|
61
|
+
"LICENSE",
|
|
62
|
+
"NOTICE",
|
|
63
|
+
"THIRD_PARTY_NOTICES.md",
|
|
64
|
+
"SECURITY.md",
|
|
65
|
+
"PRIVACY.md",
|
|
66
|
+
"providers.json.example",
|
|
67
|
+
".env.example",
|
|
68
|
+
"!**/__pycache__",
|
|
69
|
+
"!**/*.pyc",
|
|
70
|
+
"!**/.ipynb_checkpoints",
|
|
71
|
+
"!**/.pytest_cache"
|
|
72
|
+
]
|
|
73
|
+
}
|