eval: advisory instruction feedback from Claude Code sessions

`ajieval sessions` pairs each human prompt with what the assistant did
just before it, and asks Jev whether the prompt was a correction and which
repository rule (AGENTS.md, the aji-jev skill, commit memory) the corrected
behaviour broke. Excerpts are truncated and credential-like strings
redacted; answers stay in a local log, and each prompt is sent once.

`sessions report` proposes clarifying a rule only when corrections pointing
to it recur across sessions (thresholds in triage.json); it never edits
instructions. `sessions hook` is meant for a personal SessionEnd hook: it
returns at once and scans in the background, and does nothing without a
TypeSafe key, which may now also come from ~/.config/typesafe/api_key.
This commit is contained in:
dev committed 2026-10-07 22:37:24 +03:00
1 parent dde801c653
commit 65e7a0a97c
6 files changed
+352 -4

No files matched your search

+18 -3
View File
@@ -13,7 +13,8 @@ Boundaries (tools/eval only; never the verifier, CI gates or conformance):
the last failing commands), because unrelated detail lowers accuracy;
- the questions below are the single reviewable definition.
TYPESAFE_API_KEY bearer token (required, never recorded)
TYPESAFE_API_KEY bearer token (never recorded); if unset, the first
line of ~/.config/typesafe/api_key
TYPESAFE_BASE_URL default https://api.typesafe.ai
"""
@@ -134,10 +135,24 @@ def ask(state_obj, qs, post=None):
return resp.get("model"), answers
def _post(body):
KEY_FILE = os.path.join(os.path.expanduser("~"), ".config", "typesafe", "api_key")
def api_key():
key = os.environ.get("TYPESAFE_API_KEY")
if key:
return key
try:
with open(KEY_FILE) as f:
return f.readline().strip() or None
except OSError:
return None
def _post(body):
key = api_key()
if not key:
raise JevError("TYPESAFE_API_KEY is not set")
raise JevError(f"TYPESAFE_API_KEY is not set and {KEY_FILE} is missing")
url = os.environ.get("TYPESAFE_BASE_URL", "https://api.typesafe.ai").rstrip("/") + "/v1/systemone"
req = urllib.request.Request(url, data=json.dumps(body).encode(), method="POST",
headers={"Authorization": "Bearer " + key, "Content-Type": "application/json"})