agent-memory-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ # SPDX-FileCopyrightText: 2026 Kiloloop
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """``agent-memory setup <runtime>``: one planner, one applier, a spec per runtime."""
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Dict
8
+
9
+ from . import claude, codex
10
+ from .common import (
11
+ Plan,
12
+ Result,
13
+ RuntimeSpec,
14
+ SetupError,
15
+ Step,
16
+ apply_plan,
17
+ detect_repo,
18
+ known_template_digests,
19
+ known_workflow_digests,
20
+ lines,
21
+ plan_setup,
22
+ run_setup,
23
+ script_text,
24
+ template_digest,
25
+ to_json,
26
+ workflow_digest,
27
+ workflow_text,
28
+ )
29
+
30
+ SPECS: Dict[str, RuntimeSpec] = {claude.SPEC.name: claude.SPEC, codex.SPEC.name: codex.SPEC}
31
+ RUNTIMES = tuple(SPECS)
32
+
33
+ __all__ = [
34
+ "Plan",
35
+ "RUNTIMES",
36
+ "Result",
37
+ "RuntimeSpec",
38
+ "SPECS",
39
+ "SetupError",
40
+ "Step",
41
+ "apply_plan",
42
+ "detect_repo",
43
+ "known_template_digests",
44
+ "known_workflow_digests",
45
+ "lines",
46
+ "plan_setup",
47
+ "run_setup",
48
+ "script_text",
49
+ "template_digest",
50
+ "to_json",
51
+ "workflow_digest",
52
+ "workflow_text",
53
+ ]
@@ -0,0 +1,34 @@
1
+ # SPDX-FileCopyrightText: 2026 Kiloloop
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """``agent-memory setup claude``: the Claude Code hook.
4
+
5
+ Claude Code reads ``.claude/settings.json`` and runs each ``SessionStart``
6
+ command with the ``startup`` matcher when a session begins, with the
7
+ repository as its working directory; what the command prints to stdout is
8
+ added to the session's context. So the script prints its manifest, and a
9
+ warning, as plain lines. The registration retires the two hook commands the
10
+ kernel used to install, and removes their scripts only when they are byte
11
+ for byte what it wrote; the kernel's envelope hook and anything custom stay. Beside the hook goes the
12
+ workflow file, a repository skill Claude Code loads on demand.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ from . import legacy
18
+ from .common import RuntimeSpec
19
+
20
+ SETTINGS_SCHEMA = "https://json.schemastore.org/claude-code-settings.json"
21
+
22
+ SPEC = RuntimeSpec(
23
+ name="claude",
24
+ settings_file=".claude/settings.json",
25
+ script_file=".claude/hooks/agent-memory-pull.sh",
26
+ event="SessionStart",
27
+ matcher="startup",
28
+ timeout=30,
29
+ workflow_file=".claude/skills/agent-memory/SKILL.md",
30
+ report_body=" printf '%s\\n' \"$1\"",
31
+ fresh_settings={"$schema": SETTINGS_SCHEMA},
32
+ legacy_registrations=legacy.CLAUDE_LEGACY_REGISTRATIONS,
33
+ legacy_files=legacy.CLAUDE_LEGACY_FILES,
34
+ )
@@ -0,0 +1,39 @@
1
+ # SPDX-FileCopyrightText: 2026 Kiloloop
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """``agent-memory setup codex``: the Codex hook.
4
+
5
+ Codex reads ``.codex/hooks.json``; a ``SessionStart`` entry whose matcher is
6
+ ``^startup$`` runs when a session begins, and the command answers with a
7
+ JSON envelope whose ``additionalContext`` the runtime adds to the session.
8
+ The script therefore reports through that envelope, and the ``startup`` verb
9
+ renders one for this runtime. The entry is the memory half only: it sits
10
+ beside the kernel's ``session-init --hook`` entry, which keeps verifying
11
+ protocol files and status, and only that entry's ``--pull-memory`` flag is
12
+ retired, so memory is pulled once. Its ``additionalContextLimit`` belongs
13
+ to it and is never touched. Beside the hook goes the workflow file, a
14
+ repository skill under ``.agents/skills/``, where Codex discovers them.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from . import legacy
20
+ from .common import RuntimeSpec
21
+
22
+ REPORT_BODY = (
23
+ " printf '{\"continue\": true, \"systemMessage\": \"%s\", \"hookSpecificOutput\": "
24
+ "{\"hookEventName\": \"SessionStart\", \"additionalContext\": \"%s\"}}\\n' \"$1\" \"$1\""
25
+ )
26
+
27
+ SPEC = RuntimeSpec(
28
+ name="codex",
29
+ settings_file=".codex/hooks.json",
30
+ script_file=".codex/hooks/agent-memory-pull.sh",
31
+ event="SessionStart",
32
+ matcher="^startup$",
33
+ timeout=60,
34
+ workflow_file=".agents/skills/agent-memory/SKILL.md",
35
+ report_body=REPORT_BODY,
36
+ hook_fields={"statusMessage": "Pulling agent memory"},
37
+ fresh_settings={"description": "agent-memory startup: pull the memory home and list the files to read."},
38
+ legacy_flag=(legacy.CODEX_SESSION_INIT_PREFIX, legacy.CODEX_LEGACY_PULL_FLAG),
39
+ )