agent-knowledge-cli 0.2.3__tar.gz → 0.2.5__tar.gz

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.
Files changed (116) hide show
  1. agent_knowledge_cli-0.2.5/PKG-INFO +305 -0
  2. agent_knowledge_cli-0.2.5/README.md +281 -0
  3. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/doctor.sh +1 -1
  4. agent_knowledge_cli-0.2.5/assets/templates/integrations/claude/CLAUDE.md +29 -0
  5. agent_knowledge_cli-0.2.5/assets/templates/integrations/claude/commands/system-update.md +10 -0
  6. agent_knowledge_cli-0.2.5/assets/templates/integrations/claude/settings.json +37 -0
  7. agent_knowledge_cli-0.2.5/assets/templates/integrations/cursor/commands/memory-update.md +13 -0
  8. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/__init__.py +1 -1
  9. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/cli.py +11 -4
  10. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/integrations.py +56 -17
  11. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/refresh.py +140 -12
  12. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/tests/test_cli.py +268 -6
  13. agent_knowledge_cli-0.2.3/PKG-INFO +0 -397
  14. agent_knowledge_cli-0.2.3/README.md +0 -373
  15. agent_knowledge_cli-0.2.3/assets/templates/integrations/claude/CLAUDE.md +0 -47
  16. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/.gitignore +0 -0
  17. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/LICENSE +0 -0
  18. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/claude/global.md +0 -0
  19. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/claude/project-template.md +0 -0
  20. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/claude/scripts/install.sh +0 -0
  21. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/commands/doctor.md +0 -0
  22. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/commands/global-knowledge-sync.md +0 -0
  23. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/commands/graphify-sync.md +0 -0
  24. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/commands/knowledge-sync.md +0 -0
  25. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/commands/ship.md +0 -0
  26. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/commands/system-update.md +0 -0
  27. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules/generate-architecture-doc.mdc +0 -0
  28. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules/history-backfill.mdc +0 -0
  29. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules/memory-bootstrap.mdc +0 -0
  30. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules/memory-writeback.mdc +0 -0
  31. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules/shared-memory.mdc +0 -0
  32. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules/workflow-orchestration.mdc +0 -0
  33. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules-global/action-first.mdc +0 -0
  34. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules-global/no-icons-emojis.mdc +0 -0
  35. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/rules-global/no-unsolicited-docs.mdc +0 -0
  36. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/bootstrap-memory-tree.sh +0 -0
  37. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/compact-memory.sh +0 -0
  38. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/global-knowledge-sync.sh +0 -0
  39. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/graphify-sync.sh +0 -0
  40. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/import-agent-history.sh +0 -0
  41. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/install-project-links.sh +0 -0
  42. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/lib/knowledge-common.sh +0 -0
  43. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/measure-token-savings.py +0 -0
  44. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/ship.sh +0 -0
  45. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/update-knowledge.sh +0 -0
  46. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/scripts/validate-knowledge.sh +0 -0
  47. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/SKILLS.md +0 -0
  48. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/branch-note-convention/SKILL.md +0 -0
  49. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/clean-web-import/SKILL.md +0 -0
  50. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/decision-recording/SKILL.md +0 -0
  51. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/evidence-handling/SKILL.md +0 -0
  52. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/history-backfill/SKILL.md +0 -0
  53. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/memory-compaction/SKILL.md +0 -0
  54. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/memory-management/SKILL.md +0 -0
  55. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/obsidian-compatible-writing/SKILL.md +0 -0
  56. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/ontology-inference/SKILL.md +0 -0
  57. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/project-memory-writing/SKILL.md +0 -0
  58. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/project-ontology-bootstrap/SKILL.md +0 -0
  59. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills/session-management/SKILL.md +0 -0
  60. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills-cursor/create-rule/SKILL.md +0 -0
  61. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills-cursor/create-skill/SKILL.md +0 -0
  62. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills-cursor/create-subagent/SKILL.md +0 -0
  63. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills-cursor/migrate-to-skills/SKILL.md +0 -0
  64. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills-cursor/shell/SKILL.md +0 -0
  65. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/skills-cursor/update-cursor-settings/SKILL.md +0 -0
  66. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/dashboards/project-overview.template.md +0 -0
  67. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/dashboards/session-rollup.template.md +0 -0
  68. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/hooks/hooks.json.template +0 -0
  69. {agent_knowledge_cli-0.2.3/assets/templates/integrations/cursor → agent_knowledge_cli-0.2.5/assets/templates/integrations/claude}/commands/memory-update.md +0 -0
  70. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/integrations/codex/AGENTS.md +0 -0
  71. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/integrations/cursor/agent-knowledge.mdc +0 -0
  72. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/integrations/cursor/commands/system-update.md +0 -0
  73. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/integrations/cursor/hooks.json +0 -0
  74. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/memory/MEMORY.root.template.md +0 -0
  75. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/memory/branch.template.md +0 -0
  76. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/memory/decision.template.md +0 -0
  77. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/memory/profile.hybrid.yaml +0 -0
  78. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/memory/profile.ml-platform.yaml +0 -0
  79. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/memory/profile.robotics.yaml +0 -0
  80. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/memory/profile.web-app.yaml +0 -0
  81. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/portfolio/.obsidian/README.md +0 -0
  82. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/portfolio/.obsidian/app.json +0 -0
  83. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/portfolio/.obsidian/core-plugins.json +0 -0
  84. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/.agent-project.yaml +0 -0
  85. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/.agentknowledgeignore +0 -0
  86. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/AGENTS.md +0 -0
  87. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/.obsidian/README.md +0 -0
  88. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/.obsidian/app.json +0 -0
  89. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/.obsidian/core-plugins.json +0 -0
  90. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Evidence/README.md +0 -0
  91. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Evidence/captures/README.md +0 -0
  92. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Evidence/imports/README.md +0 -0
  93. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Evidence/raw/README.md +0 -0
  94. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Memory/MEMORY.md +0 -0
  95. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Memory/decisions/decisions.md +0 -0
  96. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Outputs/README.md +0 -0
  97. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/STATUS.md +0 -0
  98. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Sessions/README.md +0 -0
  99. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/agent-knowledge/Templates/README.md +0 -0
  100. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/assets/templates/project/gitignore.agent-knowledge +0 -0
  101. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/pyproject.toml +0 -0
  102. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/__main__.py +0 -0
  103. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/assets/__init__.py +0 -0
  104. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/__init__.py +0 -0
  105. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/canvas.py +0 -0
  106. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/capture.py +0 -0
  107. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/history.py +0 -0
  108. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/importer.py +0 -0
  109. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/index.py +0 -0
  110. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/paths.py +0 -0
  111. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/shell.py +0 -0
  112. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/site.py +0 -0
  113. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/sync.py +0 -0
  114. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/src/agent_knowledge/runtime/viewer.py +0 -0
  115. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/tests/__init__.py +0 -0
  116. {agent_knowledge_cli-0.2.3 → agent_knowledge_cli-0.2.5}/tests/test_packaging.py +0 -0
@@ -0,0 +1,305 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-knowledge-cli
3
+ Version: 0.2.5
4
+ Summary: Adaptive, file-based project knowledge for AI coding agents
5
+ Author: agent-knowledge contributors
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Documentation
16
+ Requires-Python: >=3.9
17
+ Requires-Dist: click>=8.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: build; extra == 'dev'
20
+ Requires-Dist: pytest>=7.0; extra == 'dev'
21
+ Provides-Extra: tokens
22
+ Requires-Dist: tiktoken; extra == 'tokens'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # agent-knowledge
26
+
27
+ Persistent, file-based project memory for AI coding agents.
28
+
29
+ One command gives any project a knowledge vault that agents read on startup,
30
+ maintain during work, and carry across sessions -- no database, no server,
31
+ just markdown files and a CLI.
32
+
33
+ Works with **Claude Code**, **Cursor**, and **Codex** out of the box.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install agent-knowledge-cli
39
+ ```
40
+
41
+ PyPI package name: `agent-knowledge-cli`. CLI command and all docs: `agent-knowledge`.
42
+
43
+ ## Quick Start
44
+
45
+ ```bash
46
+ cd your-project
47
+ agent-knowledge init
48
+ ```
49
+
50
+ That's it. Open the project in Claude Code or Cursor and the agent has
51
+ persistent memory automatically -- no manual prompting, no config, no setup.
52
+
53
+ `init` does everything in one shot:
54
+ - creates an external knowledge vault at `~/agent-os/projects/<slug>/`
55
+ - symlinks `./agent-knowledge` into the repo as the local handle
56
+ - installs project-local integration for both Claude Code and Cursor
57
+ - detects Codex and installs its bridge files if present
58
+ - bootstraps the memory tree and marks onboarding as `pending`
59
+ - imports repo history into `Evidence/` and backfills lightweight history from git
60
+
61
+ ## How It Works
62
+
63
+ Knowledge lives **outside** the repo at `~/agent-os/projects/<slug>/` so it persists
64
+ across branches, tools, and clones. The symlink `./agent-knowledge` gives every tool
65
+ a stable local handle.
66
+
67
+ ### Knowledge layers
68
+
69
+ | Folder | Role | Canonical? |
70
+ |--------|------|-----------|
71
+ | `Memory/` | Curated, durable facts -- source of truth | Yes |
72
+ | `History/` | What happened over time -- lightweight diary | Yes (diary) |
73
+ | `Evidence/` | Imported/extracted material, event stream | No |
74
+ | `Outputs/` | Generated views, indexes, HTML export | No |
75
+ | `Sessions/` | Ephemeral session state, prune aggressively | No |
76
+
77
+ Evidence is never auto-promoted into Memory. Outputs are never treated as truth.
78
+ Only agents and humans deliberately write to Memory or History.
79
+
80
+ ## Project-local integration
81
+
82
+ The project carries everything it needs. Both Claude Code and Cursor get full
83
+ integration installed automatically -- hooks, runtime contracts, and slash commands.
84
+ No global config required.
85
+
86
+ ## Obsidian-ready
87
+
88
+ The knowledge vault at `~/agent-os/projects/<slug>/` is a valid Obsidian vault.
89
+ Open it directly for backlinks, graph view, and note navigation.
90
+
91
+ ![Obsidian graph view of a project knowledge vault](docs/obsidian-graph.png)
92
+
93
+ For a spatial canvas of the knowledge graph:
94
+
95
+ ```bash
96
+ agent-knowledge export-canvas
97
+ # produces: agent-knowledge/Outputs/knowledge-export.canvas
98
+ ```
99
+
100
+ The vault is designed to work well in Obsidian -- good markdown, YAML frontmatter,
101
+ branch-note convention, internal links. But everything works without it too.
102
+
103
+ ### What gets installed
104
+
105
+ **Claude Code** (`.claude/`):
106
+
107
+ | File | Purpose |
108
+ |------|---------|
109
+ | `settings.json` | Lifecycle hooks: sync on SessionStart, Stop, PreCompact |
110
+ | `CLAUDE.md` | Runtime contract: knowledge layers, session protocol, onboarding |
111
+ | `commands/memory-update.md` | `/memory-update` slash command |
112
+ | `commands/system-update.md` | `/system-update` slash command |
113
+
114
+ **Cursor** (`.cursor/`):
115
+
116
+ | File | Purpose |
117
+ |------|---------|
118
+ | `rules/agent-knowledge.mdc` | Always-on rule: loads memory context on every session |
119
+ | `hooks.json` | Lifecycle hooks: sync on start, update on write, sync on stop/compact |
120
+ | `commands/memory-update.md` | `/memory-update` slash command |
121
+ | `commands/system-update.md` | `/system-update` slash command |
122
+
123
+ **Codex** (`.codex/`) -- installed when detected:
124
+
125
+ | File | Purpose |
126
+ |------|---------|
127
+ | `AGENTS.md` | Agent contract with knowledge layer instructions |
128
+
129
+ ### Session lifecycle
130
+
131
+ Hooks fire automatically -- the agent syncs memory at the start of every session
132
+ and captures state at the end, with no manual intervention:
133
+
134
+ | Event | Claude Code | Cursor | What runs |
135
+ |-------|-------------|--------|-----------|
136
+ | Session start | SessionStart | session-start | `agent-knowledge sync` |
137
+ | File saved | -- | post-write | `agent-knowledge update` |
138
+ | Task complete | Stop | stop | `agent-knowledge sync` |
139
+ | Context compaction | PreCompact | preCompact | `agent-knowledge sync` |
140
+
141
+ The runtime contract ensures the agent reads `STATUS.md` and `Memory/MEMORY.md`
142
+ at the start of every session, with no manual prompting required.
143
+
144
+ ### Slash commands
145
+
146
+ Inside any Claude Code or Cursor session:
147
+
148
+ - `/memory-update` -- sync, review session work, write stable facts to `Memory/`, summarize
149
+ - `/system-update` -- refresh integration files to the latest framework version
150
+
151
+ These are project-local and work automatically because `init` installed them.
152
+
153
+ ### Integration health
154
+
155
+ ```bash
156
+ agent-knowledge doctor
157
+ ```
158
+
159
+ Reports whether all integration files (settings, hooks, rules, commands) are
160
+ installed and current for both Claude Code and Cursor. If anything is stale or
161
+ missing, `doctor` tells you exactly what to run.
162
+
163
+ ## Commands
164
+
165
+ | Command | What it does |
166
+ |---------|-------------|
167
+ | `init` | Set up a project -- one command, no arguments needed |
168
+ | `sync` | Full sync: memory, history, git evidence, index |
169
+ | `doctor` | Validate setup, integration health, version staleness |
170
+ | `ship` | Validate + sync + commit + push |
171
+ | `search <query>` | Search the knowledge index (Memory-first) |
172
+ | `export-html` | Build a polished static site from the vault |
173
+ | `view` | Build site and open in browser |
174
+ | `clean-import <url>` | Import a URL as cleaned, non-canonical evidence |
175
+ | `refresh-system` | Refresh all integration files to the current framework version |
176
+ | `backfill-history` | Rebuild lightweight project history from git |
177
+ | `compact` | Prune stale captures and old session state |
178
+
179
+ All write commands support `--dry-run` and `--json`. Run `agent-knowledge --help` for the full list.
180
+
181
+
182
+
183
+ ## Static site export
184
+
185
+ Build a polished standalone site from your knowledge vault -- no Obsidian required:
186
+
187
+ ```bash
188
+ agent-knowledge export-html # generate
189
+ agent-knowledge view # generate and open in browser
190
+ ```
191
+
192
+ The generated site includes an overview page, branch tree navigation, note detail
193
+ view, evidence view, interactive graph view, and machine-readable `knowledge.json`
194
+ and `graph.json`. Opens via `file://` with no server needed.
195
+
196
+ Memory/ notes are always primary. Evidence and Outputs items are clearly marked
197
+ non-canonical.
198
+
199
+ ## Automatic capture
200
+
201
+ Every sync and update event is automatically recorded in `Evidence/captures/`
202
+ as a small structured YAML file. This gives a lightweight history of what
203
+ changed and when -- without a database or background service.
204
+
205
+ Captures are evidence, not memory. They accumulate quietly and can be pruned
206
+ with `agent-knowledge compact`.
207
+
208
+ ## Progressive retrieval
209
+
210
+ The knowledge index (`Outputs/knowledge-index.json` and `.md`) is regenerated
211
+ on every sync. Agents can:
212
+
213
+ 1. Load the index first (cheap, a few KB)
214
+ 2. Identify relevant branches from the shortlist
215
+ 3. Load only the full note content they actually need
216
+
217
+ Use `agent-knowledge search <query>` for a quick shortlist query from the
218
+ command line or a hook.
219
+
220
+ ## Clean web import
221
+
222
+ Import a web page as cleaned, non-canonical evidence:
223
+
224
+ ```bash
225
+ agent-knowledge clean-import https://docs.example.com/api-reference
226
+ # produces: agent-knowledge/Evidence/imports/2025-01-15-api-reference.md
227
+ ```
228
+
229
+ Strips navigation, ads, scripts, and boilerplate. Writes clean markdown with
230
+ YAML frontmatter marking it as non-canonical.
231
+
232
+ ## Project history
233
+
234
+ `init` automatically backfills a lightweight history layer when run on an existing repo.
235
+ You can also run it explicitly:
236
+
237
+ ```bash
238
+ agent-knowledge backfill-history
239
+ ```
240
+
241
+ Creates `History/events.ndjson` (append-only event log), `History/history.md`
242
+ (human-readable summary), and `History/timeline/` (sparse milestone notes).
243
+
244
+ History records what happened over time -- releases, integrations, sync events.
245
+ It is not a git replacement. Current truth lives in `Memory/`.
246
+
247
+ ## Keeping up to date
248
+
249
+ ```bash
250
+ pip install -U agent-knowledge-cli
251
+ agent-knowledge refresh-system
252
+ ```
253
+
254
+ `refresh-system` updates all integration files -- Claude settings/commands/contract,
255
+ Cursor hooks/rules/commands, `AGENTS.md` header, Codex config -- and version markers.
256
+ It never touches `Memory/`, `Evidence/`, `Sessions/`, or any curated knowledge.
257
+
258
+ `doctor` warns when the project integration is behind the installed version.
259
+
260
+ ## Custom knowledge home
261
+
262
+ ```bash
263
+ export AGENT_KNOWLEDGE_HOME=~/my-knowledge
264
+ agent-knowledge init
265
+ ```
266
+
267
+ ## Troubleshooting
268
+
269
+ ```bash
270
+ agent-knowledge doctor # validate setup and report health
271
+ agent-knowledge doctor --json # machine-readable health check
272
+ ```
273
+
274
+ Common issues:
275
+ - `./agent-knowledge` missing: run `agent-knowledge init`
276
+ - Onboarding still pending: paste the init prompt into your agent
277
+ - Claude not picking up memory: check `.claude/settings.json` exists -- run `agent-knowledge refresh-system`
278
+ - Cursor hooks not firing: check `.cursor/hooks.json` exists -- run `agent-knowledge refresh-system`
279
+ - Stale index: run `agent-knowledge sync`
280
+ - Large notes: run `agent-knowledge compact`
281
+ - **Wrong binary**: another tool may install a Node.js `agent-knowledge` that shadows ours. Check with `which -a agent-knowledge`. Fix: `export PATH="$(python3 -c 'import sysconfig; print(sysconfig.get_path("scripts"))'):$PATH"`
282
+
283
+ ## Platform support
284
+
285
+ - **macOS** and **Linux** are fully supported.
286
+ - **Windows** is not currently supported (relies on `bash` and POSIX shell scripts).
287
+ - Python 3.9+ required.
288
+
289
+ ## Package naming
290
+
291
+ | What | Value |
292
+ |------|-------|
293
+ | PyPI package | `agent-knowledge-cli` |
294
+ | CLI command | `agent-knowledge` |
295
+ | Python import | `agent_knowledge` |
296
+
297
+ ## Development
298
+
299
+ ```bash
300
+ git clone <repo-url>
301
+ cd agent-knowledge
302
+ python3 -m venv .venv && source .venv/bin/activate
303
+ pip install -e ".[dev]"
304
+ python -m pytest tests/ -q
305
+ ```
@@ -0,0 +1,281 @@
1
+ # agent-knowledge
2
+
3
+ Persistent, file-based project memory for AI coding agents.
4
+
5
+ One command gives any project a knowledge vault that agents read on startup,
6
+ maintain during work, and carry across sessions -- no database, no server,
7
+ just markdown files and a CLI.
8
+
9
+ Works with **Claude Code**, **Cursor**, and **Codex** out of the box.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install agent-knowledge-cli
15
+ ```
16
+
17
+ PyPI package name: `agent-knowledge-cli`. CLI command and all docs: `agent-knowledge`.
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ cd your-project
23
+ agent-knowledge init
24
+ ```
25
+
26
+ That's it. Open the project in Claude Code or Cursor and the agent has
27
+ persistent memory automatically -- no manual prompting, no config, no setup.
28
+
29
+ `init` does everything in one shot:
30
+ - creates an external knowledge vault at `~/agent-os/projects/<slug>/`
31
+ - symlinks `./agent-knowledge` into the repo as the local handle
32
+ - installs project-local integration for both Claude Code and Cursor
33
+ - detects Codex and installs its bridge files if present
34
+ - bootstraps the memory tree and marks onboarding as `pending`
35
+ - imports repo history into `Evidence/` and backfills lightweight history from git
36
+
37
+ ## How It Works
38
+
39
+ Knowledge lives **outside** the repo at `~/agent-os/projects/<slug>/` so it persists
40
+ across branches, tools, and clones. The symlink `./agent-knowledge` gives every tool
41
+ a stable local handle.
42
+
43
+ ### Knowledge layers
44
+
45
+ | Folder | Role | Canonical? |
46
+ |--------|------|-----------|
47
+ | `Memory/` | Curated, durable facts -- source of truth | Yes |
48
+ | `History/` | What happened over time -- lightweight diary | Yes (diary) |
49
+ | `Evidence/` | Imported/extracted material, event stream | No |
50
+ | `Outputs/` | Generated views, indexes, HTML export | No |
51
+ | `Sessions/` | Ephemeral session state, prune aggressively | No |
52
+
53
+ Evidence is never auto-promoted into Memory. Outputs are never treated as truth.
54
+ Only agents and humans deliberately write to Memory or History.
55
+
56
+ ## Project-local integration
57
+
58
+ The project carries everything it needs. Both Claude Code and Cursor get full
59
+ integration installed automatically -- hooks, runtime contracts, and slash commands.
60
+ No global config required.
61
+
62
+ ## Obsidian-ready
63
+
64
+ The knowledge vault at `~/agent-os/projects/<slug>/` is a valid Obsidian vault.
65
+ Open it directly for backlinks, graph view, and note navigation.
66
+
67
+ ![Obsidian graph view of a project knowledge vault](docs/obsidian-graph.png)
68
+
69
+ For a spatial canvas of the knowledge graph:
70
+
71
+ ```bash
72
+ agent-knowledge export-canvas
73
+ # produces: agent-knowledge/Outputs/knowledge-export.canvas
74
+ ```
75
+
76
+ The vault is designed to work well in Obsidian -- good markdown, YAML frontmatter,
77
+ branch-note convention, internal links. But everything works without it too.
78
+
79
+ ### What gets installed
80
+
81
+ **Claude Code** (`.claude/`):
82
+
83
+ | File | Purpose |
84
+ |------|---------|
85
+ | `settings.json` | Lifecycle hooks: sync on SessionStart, Stop, PreCompact |
86
+ | `CLAUDE.md` | Runtime contract: knowledge layers, session protocol, onboarding |
87
+ | `commands/memory-update.md` | `/memory-update` slash command |
88
+ | `commands/system-update.md` | `/system-update` slash command |
89
+
90
+ **Cursor** (`.cursor/`):
91
+
92
+ | File | Purpose |
93
+ |------|---------|
94
+ | `rules/agent-knowledge.mdc` | Always-on rule: loads memory context on every session |
95
+ | `hooks.json` | Lifecycle hooks: sync on start, update on write, sync on stop/compact |
96
+ | `commands/memory-update.md` | `/memory-update` slash command |
97
+ | `commands/system-update.md` | `/system-update` slash command |
98
+
99
+ **Codex** (`.codex/`) -- installed when detected:
100
+
101
+ | File | Purpose |
102
+ |------|---------|
103
+ | `AGENTS.md` | Agent contract with knowledge layer instructions |
104
+
105
+ ### Session lifecycle
106
+
107
+ Hooks fire automatically -- the agent syncs memory at the start of every session
108
+ and captures state at the end, with no manual intervention:
109
+
110
+ | Event | Claude Code | Cursor | What runs |
111
+ |-------|-------------|--------|-----------|
112
+ | Session start | SessionStart | session-start | `agent-knowledge sync` |
113
+ | File saved | -- | post-write | `agent-knowledge update` |
114
+ | Task complete | Stop | stop | `agent-knowledge sync` |
115
+ | Context compaction | PreCompact | preCompact | `agent-knowledge sync` |
116
+
117
+ The runtime contract ensures the agent reads `STATUS.md` and `Memory/MEMORY.md`
118
+ at the start of every session, with no manual prompting required.
119
+
120
+ ### Slash commands
121
+
122
+ Inside any Claude Code or Cursor session:
123
+
124
+ - `/memory-update` -- sync, review session work, write stable facts to `Memory/`, summarize
125
+ - `/system-update` -- refresh integration files to the latest framework version
126
+
127
+ These are project-local and work automatically because `init` installed them.
128
+
129
+ ### Integration health
130
+
131
+ ```bash
132
+ agent-knowledge doctor
133
+ ```
134
+
135
+ Reports whether all integration files (settings, hooks, rules, commands) are
136
+ installed and current for both Claude Code and Cursor. If anything is stale or
137
+ missing, `doctor` tells you exactly what to run.
138
+
139
+ ## Commands
140
+
141
+ | Command | What it does |
142
+ |---------|-------------|
143
+ | `init` | Set up a project -- one command, no arguments needed |
144
+ | `sync` | Full sync: memory, history, git evidence, index |
145
+ | `doctor` | Validate setup, integration health, version staleness |
146
+ | `ship` | Validate + sync + commit + push |
147
+ | `search <query>` | Search the knowledge index (Memory-first) |
148
+ | `export-html` | Build a polished static site from the vault |
149
+ | `view` | Build site and open in browser |
150
+ | `clean-import <url>` | Import a URL as cleaned, non-canonical evidence |
151
+ | `refresh-system` | Refresh all integration files to the current framework version |
152
+ | `backfill-history` | Rebuild lightweight project history from git |
153
+ | `compact` | Prune stale captures and old session state |
154
+
155
+ All write commands support `--dry-run` and `--json`. Run `agent-knowledge --help` for the full list.
156
+
157
+
158
+
159
+ ## Static site export
160
+
161
+ Build a polished standalone site from your knowledge vault -- no Obsidian required:
162
+
163
+ ```bash
164
+ agent-knowledge export-html # generate
165
+ agent-knowledge view # generate and open in browser
166
+ ```
167
+
168
+ The generated site includes an overview page, branch tree navigation, note detail
169
+ view, evidence view, interactive graph view, and machine-readable `knowledge.json`
170
+ and `graph.json`. Opens via `file://` with no server needed.
171
+
172
+ Memory/ notes are always primary. Evidence and Outputs items are clearly marked
173
+ non-canonical.
174
+
175
+ ## Automatic capture
176
+
177
+ Every sync and update event is automatically recorded in `Evidence/captures/`
178
+ as a small structured YAML file. This gives a lightweight history of what
179
+ changed and when -- without a database or background service.
180
+
181
+ Captures are evidence, not memory. They accumulate quietly and can be pruned
182
+ with `agent-knowledge compact`.
183
+
184
+ ## Progressive retrieval
185
+
186
+ The knowledge index (`Outputs/knowledge-index.json` and `.md`) is regenerated
187
+ on every sync. Agents can:
188
+
189
+ 1. Load the index first (cheap, a few KB)
190
+ 2. Identify relevant branches from the shortlist
191
+ 3. Load only the full note content they actually need
192
+
193
+ Use `agent-knowledge search <query>` for a quick shortlist query from the
194
+ command line or a hook.
195
+
196
+ ## Clean web import
197
+
198
+ Import a web page as cleaned, non-canonical evidence:
199
+
200
+ ```bash
201
+ agent-knowledge clean-import https://docs.example.com/api-reference
202
+ # produces: agent-knowledge/Evidence/imports/2025-01-15-api-reference.md
203
+ ```
204
+
205
+ Strips navigation, ads, scripts, and boilerplate. Writes clean markdown with
206
+ YAML frontmatter marking it as non-canonical.
207
+
208
+ ## Project history
209
+
210
+ `init` automatically backfills a lightweight history layer when run on an existing repo.
211
+ You can also run it explicitly:
212
+
213
+ ```bash
214
+ agent-knowledge backfill-history
215
+ ```
216
+
217
+ Creates `History/events.ndjson` (append-only event log), `History/history.md`
218
+ (human-readable summary), and `History/timeline/` (sparse milestone notes).
219
+
220
+ History records what happened over time -- releases, integrations, sync events.
221
+ It is not a git replacement. Current truth lives in `Memory/`.
222
+
223
+ ## Keeping up to date
224
+
225
+ ```bash
226
+ pip install -U agent-knowledge-cli
227
+ agent-knowledge refresh-system
228
+ ```
229
+
230
+ `refresh-system` updates all integration files -- Claude settings/commands/contract,
231
+ Cursor hooks/rules/commands, `AGENTS.md` header, Codex config -- and version markers.
232
+ It never touches `Memory/`, `Evidence/`, `Sessions/`, or any curated knowledge.
233
+
234
+ `doctor` warns when the project integration is behind the installed version.
235
+
236
+ ## Custom knowledge home
237
+
238
+ ```bash
239
+ export AGENT_KNOWLEDGE_HOME=~/my-knowledge
240
+ agent-knowledge init
241
+ ```
242
+
243
+ ## Troubleshooting
244
+
245
+ ```bash
246
+ agent-knowledge doctor # validate setup and report health
247
+ agent-knowledge doctor --json # machine-readable health check
248
+ ```
249
+
250
+ Common issues:
251
+ - `./agent-knowledge` missing: run `agent-knowledge init`
252
+ - Onboarding still pending: paste the init prompt into your agent
253
+ - Claude not picking up memory: check `.claude/settings.json` exists -- run `agent-knowledge refresh-system`
254
+ - Cursor hooks not firing: check `.cursor/hooks.json` exists -- run `agent-knowledge refresh-system`
255
+ - Stale index: run `agent-knowledge sync`
256
+ - Large notes: run `agent-knowledge compact`
257
+ - **Wrong binary**: another tool may install a Node.js `agent-knowledge` that shadows ours. Check with `which -a agent-knowledge`. Fix: `export PATH="$(python3 -c 'import sysconfig; print(sysconfig.get_path("scripts"))'):$PATH"`
258
+
259
+ ## Platform support
260
+
261
+ - **macOS** and **Linux** are fully supported.
262
+ - **Windows** is not currently supported (relies on `bash` and POSIX shell scripts).
263
+ - Python 3.9+ required.
264
+
265
+ ## Package naming
266
+
267
+ | What | Value |
268
+ |------|-------|
269
+ | PyPI package | `agent-knowledge-cli` |
270
+ | CLI command | `agent-knowledge` |
271
+ | Python import | `agent_knowledge` |
272
+
273
+ ## Development
274
+
275
+ ```bash
276
+ git clone <repo-url>
277
+ cd agent-knowledge
278
+ python3 -m venv .venv && source .venv/bin/activate
279
+ pip install -e ".[dev]"
280
+ python -m pytest tests/ -q
281
+ ```
@@ -87,7 +87,7 @@ fi
87
87
  # Detect integrations
88
88
  INTEGRATIONS=()
89
89
  [ -d "$TARGET_PROJECT/.cursor" ] && INTEGRATIONS+=("cursor")
90
- [ -d "$TARGET_PROJECT/.claude" ] || [ -f "$TARGET_PROJECT/CLAUDE.md" ] && INTEGRATIONS+=("claude")
90
+ { [ -f "$TARGET_PROJECT/.claude/settings.json" ] || [ -f "$TARGET_PROJECT/.claude/CLAUDE.md" ] || [ -d "$TARGET_PROJECT/.claude" ]; } && INTEGRATIONS+=("claude")
91
91
  [ -d "$TARGET_PROJECT/.codex" ] && INTEGRATIONS+=("codex")
92
92
 
93
93
  # Read onboarding state
@@ -0,0 +1,29 @@
1
+ # agent-knowledge
2
+
3
+ This project uses **agent-knowledge** for persistent project memory.
4
+ All knowledge lives in `./agent-knowledge/` (symlink to external vault).
5
+
6
+ ## On session start
7
+
8
+ 1. Read `./agent-knowledge/STATUS.md`
9
+ 2. If `onboarding: pending` -- read `AGENTS.md` and perform First-Time Onboarding
10
+ 3. If `onboarding: complete` -- read `./agent-knowledge/Memory/MEMORY.md`
11
+ - Load branch notes relevant to the current task
12
+ - Scan `./agent-knowledge/History/history.md` for recent activity if useful
13
+
14
+ ## Knowledge layers
15
+
16
+ | Layer | Canonical? | Use for |
17
+ |-------|-----------|---------|
18
+ | `Memory/` | Yes | Stable project truth -- write here |
19
+ | `History/` | Yes (diary) | What happened over time |
20
+ | `Evidence/` | No | Raw imports -- never promote to Memory |
21
+ | `Outputs/` | No | Generated views -- never treat as truth |
22
+ | `Sessions/` | No | Temporary state -- prune aggressively |
23
+
24
+ ## After meaningful work
25
+
26
+ - Write confirmed facts to `./agent-knowledge/Memory/<branch>.md`
27
+ - Run `/memory-update` or `agent-knowledge sync --project .`
28
+
29
+ Keep ontology small and project-native. Do not force generic templates.
@@ -0,0 +1,10 @@
1
+ Refresh this project's agent-knowledge integration to the latest framework version.
2
+
3
+ Run in terminal:
4
+ `agent-knowledge refresh-system --project .`
5
+
6
+ Then report:
7
+ - What integration files were updated (hooks, settings, commands, AGENTS.md)
8
+ - What was already current and skipped
9
+ - Any warnings about customized or stale files
10
+ - The current framework version now in effect
@@ -0,0 +1,37 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "agent-knowledge sync --project <repo-path>"
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "Stop": [
15
+ {
16
+ "matcher": "",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "agent-knowledge sync --project <repo-path>"
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "PreCompact": [
26
+ {
27
+ "matcher": "",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "agent-knowledge sync --project <repo-path>"
32
+ }
33
+ ]
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,13 @@
1
+ Perform a project memory update.
2
+
3
+ Steps:
4
+ 1. Run in terminal: `agent-knowledge sync --project .`
5
+ 2. Review this session's work and identify what stable project knowledge changed
6
+ 3. For each changed area, update the relevant `./agent-knowledge/Memory/<branch>.md`:
7
+ - Edit the Current State section with confirmed facts
8
+ - Add a dated entry to Recent Changes: `YYYY-MM-DD -- what changed`
9
+ 4. If branch summaries changed, update `./agent-knowledge/Memory/MEMORY.md`
10
+ 5. Summarize: what branches were updated, what was skipped, and why
11
+
12
+ Write to Memory only for stable, confirmed facts. Skip speculative or session-only context.
13
+ Evidence and captures go to `Evidence/`, not `Memory/`.
@@ -1,3 +1,3 @@
1
1
  """agent-knowledge: adaptive, file-based project knowledge for AI coding agents."""
2
2
 
3
- __version__ = "0.2.3"
3
+ __version__ = "0.2.5"