Recently Written · git

ai-config

One canonical AI agent config (rules, skills, MCP servers) rendered into Claude Code, Codex, Copilot CLI and Antigravity by acsync

git clone https://github.com/equwal/ai-config

Log | Files | Refs


skills/memstate/scripts/memstate_set.py (1394 bytes)

1 #!/usr/bin/env python3
2 """Store a single fact at a keypath (memstated).
3 
4 --scope user writes to the reserved user scope. The daemon accepts only
5 preferences.*, profile.*, host.<host_slug>.env.* and host.<host_slug>.tools.*
6 there; see SKILL.md, "User scope".
7 """
8 import argparse
9 import sys
10 
11 from _client import add_scope_args, add_write_args, check_write_target, post, resolve_project
12 
13 
14 def main() -> int:
15     ap = argparse.ArgumentParser(description="Set a single fact at a keypath")
16     add_scope_args(ap)
17     add_write_args(ap)
18     ap.add_argument("--keypath", required=True)
19     ap.add_argument("--value", required=True)
20     ap.add_argument("--source", default=None)
21     ap.add_argument("--category", default=None,
22                     help="optional label, e.g. decision, config")
23     ap.add_argument("--topics", default=None,
24                     help="comma-separated tags for filtered search")
25     args = ap.parse_args()
26 
27     project = resolve_project(args)
28     check_write_target(args, project)
29     body = {
30         "project_id": project,
31         "keypath": args.keypath,
32         "content": args.value,
33     }
34     if args.source:
35         body["source"] = args.source
36     if args.category:
37         body["category"] = args.category
38     if args.topics:
39         body["topics"] = args.topics.split(",")
40     return post("/memories/store", body)
41 
42 
43 if __name__ == "__main__":
44     sys.exit(main())