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:
1 parent
3a367b7bcc
commit
d62673e48b
89 files changed
+13463
-241
No files matched your search
@@ -0,0 +1,54 @@
|
||||
"""Privacy tokens [[TOKEN]] in templates. Distinct from context {{key}}."""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from placeholders import PlaceholderError
|
||||
|
||||
PRIVACY_PATTERN = re.compile(r"\[\[([A-Z][A-Z0-9_]*(?::[A-Z0-9_]+)?)\]\]")
|
||||
KNOWN_EXACT = {"SELF"}
|
||||
KNOWN_PREFIXES = ("PERSON:", "PLACE:")
|
||||
|
||||
|
||||
def catalog() -> list[dict]:
|
||||
return [
|
||||
{
|
||||
"token": "[[SELF]]",
|
||||
"kind": "exact",
|
||||
"data_class": "B",
|
||||
"description": "Die reflektierende Person. Mapping bleibt lokal.",
|
||||
},
|
||||
{
|
||||
"token": "[[PERSON:ROLE]]",
|
||||
"kind": "prefix",
|
||||
"data_class": "B",
|
||||
"description": "Andere Person als nicht sprechende Rolle, nicht als Klarname.",
|
||||
},
|
||||
{
|
||||
"token": "[[PLACE:KIND]]",
|
||||
"kind": "prefix",
|
||||
"data_class": "B",
|
||||
"description": "Ort als Kategorie, nicht als Adresse oder Stadtname.",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def extract_tokens(template: str) -> list[str]:
|
||||
return PRIVACY_PATTERN.findall(template or "")
|
||||
|
||||
|
||||
def validate_tokens(template: str) -> list[str]:
|
||||
tokens = extract_tokens(template)
|
||||
invalid = []
|
||||
for token in tokens:
|
||||
if token in KNOWN_EXACT:
|
||||
continue
|
||||
if any(token.startswith(prefix) for prefix in KNOWN_PREFIXES):
|
||||
continue
|
||||
invalid.append(f"[[{token}]]")
|
||||
if invalid:
|
||||
raise PlaceholderError(
|
||||
"unknown_privacy_placeholder",
|
||||
"Unbekannte Privacy-Platzhalter: " + ", ".join(sorted(set(invalid))),
|
||||
)
|
||||
return [f"[[{token}]]" for token in tokens]
|
||||
Reference in new issue
Block a user