Fix 'noted' contextual inertia in queries
Two changes to memwalk/ingest.py:
1. Ingest prompt now asks the model for a brief theme + standout
projects summary instead of "Reply noted". The "X → noted"
pattern was training the model in-context to reply "noted" to
every follow-up regardless of question.
2. query() wraps the user question in a short framing prefix
("Drawing on the work activity I shared with you earlier,
please answer this clearly and concretely: ...") which is
enough to break the noted pattern even on pre-existing state
files, so existing users don't need to rebuild to benefit.
Verified on the maintainer's state: vague greetings still
default to noted (degenerate case, CLI is for questions),
but real questions like "What did I work on this past month?"
and "What features did I ship in Randify.pro?" now produce
detailed accurate responses. Standup output now includes
real blockers extracted from commit messages.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+16
-6
@@ -74,13 +74,14 @@ def update(cfg: Config, *, verbose: bool = False) -> dict:
|
|||||||
sess = open_session(cfg, verbose=verbose)
|
sess = open_session(cfg, verbose=verbose)
|
||||||
|
|
||||||
prompt = (
|
prompt = (
|
||||||
"I will now feed you a summary of my recent work activity. "
|
"Below is a record of my recent work activity. Read it carefully, "
|
||||||
"Read it and incorporate into your understanding of what I've been "
|
"then in two short sentences describe (a) the dominant theme of "
|
||||||
"doing. Reply with just 'noted'.\n\n" + block
|
"this period and (b) one or two standout projects. I will ask "
|
||||||
|
"specific follow-up questions in later turns.\n\n" + block
|
||||||
)
|
)
|
||||||
|
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
ack = sess.chat(prompt, max_tokens=20)
|
ack = sess.chat(prompt, max_tokens=120)
|
||||||
elapsed = time.time() - t0
|
elapsed = time.time() - t0
|
||||||
|
|
||||||
sess.save()
|
sess.save()
|
||||||
@@ -101,8 +102,17 @@ def update(cfg: Config, *, verbose: bool = False) -> dict:
|
|||||||
|
|
||||||
def query(cfg: Config, question: str, max_tokens: int = 400,
|
def query(cfg: Config, question: str, max_tokens: int = 400,
|
||||||
verbose: bool = False) -> str:
|
verbose: bool = False) -> str:
|
||||||
"""Load the current state and ask a question."""
|
"""Load the current state and ask a question.
|
||||||
|
|
||||||
|
The question is wrapped in a short framing prefix so the model
|
||||||
|
switches out of any acknowledgement pattern carried by prior ingest
|
||||||
|
turns and actually answers from the activity it absorbed.
|
||||||
|
"""
|
||||||
if not cfg.state_path.exists():
|
if not cfg.state_path.exists():
|
||||||
raise FileNotFoundError("No state yet — run `memwalk update` first.")
|
raise FileNotFoundError("No state yet — run `memwalk update` first.")
|
||||||
sess = open_session(cfg, verbose=verbose)
|
sess = open_session(cfg, verbose=verbose)
|
||||||
return sess.chat(question, max_tokens=max_tokens)
|
framed = (
|
||||||
|
"Drawing on the work activity I shared with you earlier, please "
|
||||||
|
f"answer this clearly and concretely:\n\n{question}"
|
||||||
|
)
|
||||||
|
return sess.chat(framed, max_tokens=max_tokens)
|
||||||
|
|||||||
Reference in New Issue
Block a user