Update .gitignore to exclude Python-related files and directories. Enhance AGENTS.md and README.md with clarifications on documentation structure and product identity. Add technical architecture references and local setup instructions. Revise privacy guardrails and product identity documents for consistency. Remove obsolete memory and context documentation. Expand reflection spaces documentation to define context boundaries and lifecycle. Ensure all changes align with the ongoing development of the Kanshō project.

This commit is contained in:
Lars committed 2026-08-21 15:48:43 +02:00
1 parent 3a367b7bcc
commit d62673e48b
89 files changed
+13463 -241

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
"""Continuity checkpoint. No LLM. Session end must not mutate threads."""
from __future__ import annotations
from db import get_db, row_to_dict
from dialogue_store import StoreError, end_usage_session, list_messages, thread_snapshot
def checkpoint_usage_session(profile_id: str, usage_session_id: str) -> dict:
"""Ensure originals are stored. Does not insert summaries or change thread status."""
threads_before = thread_snapshot(profile_id)
with get_db() as conn:
session = row_to_dict(
conn.execute(
"SELECT * FROM usage_sessions WHERE id = ? AND profile_id = ?",
(usage_session_id, profile_id),
).fetchone()
)
if not session:
raise StoreError("not_found", "Nutzungssitzung nicht gefunden", 404)
conv_rows = conn.execute(
"SELECT id FROM conversations WHERE profile_id = ? AND usage_session_id = ?",
(profile_id, usage_session_id),
).fetchall()
conversations = []
message_count = 0
for row in conv_rows:
messages = list_messages(profile_id, row["id"])
message_count += len(messages)
conversations.append({"id": row["id"], "message_count": len(messages)})
if thread_snapshot(profile_id) != threads_before:
raise StoreError("thread_mutated", "Checkpoint darf Thread-Felder nicht ändern", 500)
return {
"usage_session_id": usage_session_id,
"ended_at": session.get("ended_at"),
"conversations": conversations,
"message_count": message_count,
"threads_unchanged": True,
"llm": False,
}
def close_usage_session(profile_id: str, usage_session_id: str) -> dict:
threads_before = thread_snapshot(profile_id)
ended = end_usage_session(profile_id, usage_session_id)
checkpoint = checkpoint_usage_session(profile_id, usage_session_id)
if thread_snapshot(profile_id) != threads_before:
raise StoreError("thread_mutated", "Session-Ende darf Thread-Status nicht ändern", 500)
checkpoint["usage_session"] = ended
return checkpoint