agent-knowledge-cli 0.1.2__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 (91) hide show
  1. agent_knowledge_cli-0.1.2/.gitignore +21 -0
  2. agent_knowledge_cli-0.1.2/LICENSE +21 -0
  3. agent_knowledge_cli-0.1.2/PKG-INFO +155 -0
  4. agent_knowledge_cli-0.1.2/README.md +131 -0
  5. agent_knowledge_cli-0.1.2/assets/claude/global.md +44 -0
  6. agent_knowledge_cli-0.1.2/assets/claude/project-template.md +46 -0
  7. agent_knowledge_cli-0.1.2/assets/claude/scripts/install.sh +85 -0
  8. agent_knowledge_cli-0.1.2/assets/commands/doctor.md +21 -0
  9. agent_knowledge_cli-0.1.2/assets/commands/global-knowledge-sync.md +27 -0
  10. agent_knowledge_cli-0.1.2/assets/commands/graphify-sync.md +26 -0
  11. agent_knowledge_cli-0.1.2/assets/commands/knowledge-sync.md +26 -0
  12. agent_knowledge_cli-0.1.2/assets/commands/ship.md +29 -0
  13. agent_knowledge_cli-0.1.2/assets/rules/generate-architecture-doc.mdc +87 -0
  14. agent_knowledge_cli-0.1.2/assets/rules/history-backfill.mdc +67 -0
  15. agent_knowledge_cli-0.1.2/assets/rules/memory-bootstrap.mdc +53 -0
  16. agent_knowledge_cli-0.1.2/assets/rules/memory-writeback.mdc +90 -0
  17. agent_knowledge_cli-0.1.2/assets/rules/shared-memory.mdc +102 -0
  18. agent_knowledge_cli-0.1.2/assets/rules/workflow-orchestration.mdc +93 -0
  19. agent_knowledge_cli-0.1.2/assets/rules-global/action-first.mdc +26 -0
  20. agent_knowledge_cli-0.1.2/assets/rules-global/no-icons-emojis.mdc +16 -0
  21. agent_knowledge_cli-0.1.2/assets/rules-global/no-unsolicited-docs.mdc +20 -0
  22. agent_knowledge_cli-0.1.2/assets/scripts/bootstrap-memory-tree.sh +389 -0
  23. agent_knowledge_cli-0.1.2/assets/scripts/compact-memory.sh +191 -0
  24. agent_knowledge_cli-0.1.2/assets/scripts/doctor.sh +137 -0
  25. agent_knowledge_cli-0.1.2/assets/scripts/global-knowledge-sync.sh +372 -0
  26. agent_knowledge_cli-0.1.2/assets/scripts/graphify-sync.sh +397 -0
  27. agent_knowledge_cli-0.1.2/assets/scripts/import-agent-history.sh +706 -0
  28. agent_knowledge_cli-0.1.2/assets/scripts/install-project-links.sh +258 -0
  29. agent_knowledge_cli-0.1.2/assets/scripts/lib/knowledge-common.sh +875 -0
  30. agent_knowledge_cli-0.1.2/assets/scripts/measure-token-savings.py +540 -0
  31. agent_knowledge_cli-0.1.2/assets/scripts/ship.sh +256 -0
  32. agent_knowledge_cli-0.1.2/assets/scripts/update-knowledge.sh +341 -0
  33. agent_knowledge_cli-0.1.2/assets/scripts/validate-knowledge.sh +265 -0
  34. agent_knowledge_cli-0.1.2/assets/skills/decision-recording/SKILL.md +124 -0
  35. agent_knowledge_cli-0.1.2/assets/skills/history-backfill/SKILL.md +115 -0
  36. agent_knowledge_cli-0.1.2/assets/skills/memory-compaction/SKILL.md +115 -0
  37. agent_knowledge_cli-0.1.2/assets/skills/memory-management/SKILL.md +134 -0
  38. agent_knowledge_cli-0.1.2/assets/skills/project-ontology-bootstrap/SKILL.md +173 -0
  39. agent_knowledge_cli-0.1.2/assets/skills/session-management/SKILL.md +116 -0
  40. agent_knowledge_cli-0.1.2/assets/skills-cursor/create-rule/SKILL.md +164 -0
  41. agent_knowledge_cli-0.1.2/assets/skills-cursor/create-skill/SKILL.md +498 -0
  42. agent_knowledge_cli-0.1.2/assets/skills-cursor/create-subagent/SKILL.md +225 -0
  43. agent_knowledge_cli-0.1.2/assets/skills-cursor/migrate-to-skills/SKILL.md +134 -0
  44. agent_knowledge_cli-0.1.2/assets/skills-cursor/shell/SKILL.md +24 -0
  45. agent_knowledge_cli-0.1.2/assets/skills-cursor/update-cursor-settings/SKILL.md +122 -0
  46. agent_knowledge_cli-0.1.2/assets/templates/dashboards/project-overview.template.md +24 -0
  47. agent_knowledge_cli-0.1.2/assets/templates/dashboards/session-rollup.template.md +23 -0
  48. agent_knowledge_cli-0.1.2/assets/templates/hooks/hooks.json.template +11 -0
  49. agent_knowledge_cli-0.1.2/assets/templates/integrations/claude/CLAUDE.md +7 -0
  50. agent_knowledge_cli-0.1.2/assets/templates/integrations/codex/AGENTS.md +7 -0
  51. agent_knowledge_cli-0.1.2/assets/templates/integrations/cursor/agent-knowledge.mdc +11 -0
  52. agent_knowledge_cli-0.1.2/assets/templates/integrations/cursor/hooks.json +11 -0
  53. agent_knowledge_cli-0.1.2/assets/templates/memory/MEMORY.root.template.md +36 -0
  54. agent_knowledge_cli-0.1.2/assets/templates/memory/branch.template.md +33 -0
  55. agent_knowledge_cli-0.1.2/assets/templates/memory/decision.template.md +33 -0
  56. agent_knowledge_cli-0.1.2/assets/templates/memory/profile.hybrid.yaml +16 -0
  57. agent_knowledge_cli-0.1.2/assets/templates/memory/profile.ml-platform.yaml +18 -0
  58. agent_knowledge_cli-0.1.2/assets/templates/memory/profile.robotics.yaml +19 -0
  59. agent_knowledge_cli-0.1.2/assets/templates/memory/profile.web-app.yaml +16 -0
  60. agent_knowledge_cli-0.1.2/assets/templates/portfolio/.obsidian/README.md +21 -0
  61. agent_knowledge_cli-0.1.2/assets/templates/portfolio/.obsidian/app.json +5 -0
  62. agent_knowledge_cli-0.1.2/assets/templates/portfolio/.obsidian/core-plugins.json +7 -0
  63. agent_knowledge_cli-0.1.2/assets/templates/project/.agent-project.yaml +36 -0
  64. agent_knowledge_cli-0.1.2/assets/templates/project/.agentknowledgeignore +10 -0
  65. agent_knowledge_cli-0.1.2/assets/templates/project/AGENTS.md +87 -0
  66. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/.obsidian/README.md +23 -0
  67. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/.obsidian/app.json +5 -0
  68. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/.obsidian/core-plugins.json +7 -0
  69. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Evidence/README.md +34 -0
  70. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Evidence/imports/README.md +29 -0
  71. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Evidence/raw/README.md +25 -0
  72. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Memory/MEMORY.md +37 -0
  73. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Memory/decisions/decisions.md +31 -0
  74. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Outputs/README.md +24 -0
  75. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/STATUS.md +43 -0
  76. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Sessions/README.md +21 -0
  77. agent_knowledge_cli-0.1.2/assets/templates/project/agent-knowledge/Templates/README.md +19 -0
  78. agent_knowledge_cli-0.1.2/assets/templates/project/gitignore.agent-knowledge +13 -0
  79. agent_knowledge_cli-0.1.2/pyproject.toml +56 -0
  80. agent_knowledge_cli-0.1.2/src/agent_knowledge/__init__.py +3 -0
  81. agent_knowledge_cli-0.1.2/src/agent_knowledge/__main__.py +3 -0
  82. agent_knowledge_cli-0.1.2/src/agent_knowledge/assets/__init__.py +0 -0
  83. agent_knowledge_cli-0.1.2/src/agent_knowledge/cli.py +457 -0
  84. agent_knowledge_cli-0.1.2/src/agent_knowledge/runtime/__init__.py +0 -0
  85. agent_knowledge_cli-0.1.2/src/agent_knowledge/runtime/integrations.py +154 -0
  86. agent_knowledge_cli-0.1.2/src/agent_knowledge/runtime/paths.py +46 -0
  87. agent_knowledge_cli-0.1.2/src/agent_knowledge/runtime/shell.py +22 -0
  88. agent_knowledge_cli-0.1.2/src/agent_knowledge/runtime/sync.py +255 -0
  89. agent_knowledge_cli-0.1.2/tests/__init__.py +0 -0
  90. agent_knowledge_cli-0.1.2/tests/test_cli.py +317 -0
  91. agent_knowledge_cli-0.1.2/tests/test_packaging.py +87 -0
@@ -0,0 +1,21 @@
1
+ *.swp
2
+ *.swo
3
+ *~
4
+ .DS_Store
5
+ __pycache__/
6
+ *.pyc
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ *.whl
11
+ .eggs/
12
+ .venv/
13
+ .pytest_cache/
14
+
15
+ # Local project knowledge (created by agent-knowledge init on this repo)
16
+ /agent-knowledge
17
+ /.agent-project.yaml
18
+ /.agentknowledgeignore
19
+ /AGENTS.md
20
+ /CLAUDE.md
21
+ /.cursor/hooks.json
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agent-knowledge contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-knowledge-cli
3
+ Version: 0.1.2
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
+ ## Install
34
+
35
+ ```
36
+ pip install agent-knowledge-cli
37
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ ```
42
+ cd your-project
43
+ agent-knowledge init
44
+ ```
45
+
46
+ Open Cursor, Claude, or Codex in the repo -- the agent picks up from there.
47
+
48
+ `init` automatically:
49
+ - infers the project slug from the directory name
50
+ - creates an external knowledge vault at `~/agent-os/projects/<slug>/`
51
+ - symlinks `./agent-knowledge` into the repo as the local handle
52
+ - detects Cursor, Claude, and Codex and installs integration files
53
+ - bootstraps the memory tree and marks onboarding as `pending`
54
+ - prints the prompt to kick off first-time agent ingestion
55
+
56
+ ## How It Works
57
+
58
+ ```
59
+ your-project/
60
+ .agent-project.yaml # project config
61
+ AGENTS.md # instructions agents read on startup
62
+ agent-knowledge/ # symlink -> ~/agent-os/projects/<slug>/
63
+ STATUS.md # onboarding state + sync timestamps
64
+ Memory/
65
+ MEMORY.md # root entrypoint (read first)
66
+ stack.md # flat branch note
67
+ perception/
68
+ perception.md # branch entry (same name as folder)
69
+ fusion.md # subtopic note
70
+ decisions/
71
+ decisions.md # decision log
72
+ Evidence/ # imported/extracted material
73
+ Outputs/ # generated views (never canonical)
74
+ Sessions/ # ephemeral session state
75
+ ```
76
+
77
+ Knowledge lives **outside** the repo so it persists across branches, tools,
78
+ and clones. The symlink gives every tool a stable `./agent-knowledge` path.
79
+
80
+ When an agent opens the repo it reads `AGENTS.md` and `STATUS.md`.
81
+ If onboarding is pending, it inspects the project, imports evidence,
82
+ infers the ontology from the actual repo, and writes curated memory.
83
+ After that, maintenance is automatic.
84
+
85
+ ## Branch Convention
86
+
87
+ The memory tree uses a same-name branch-note convention:
88
+
89
+ - **Flat note** (`stack.md`): for topics with no subtopics
90
+ - **Folder** (`perception/perception.md`): for topics that grow subtopics
91
+ - **Folder name = topic**, entry note = same name as folder
92
+ - **Agents infer** the branch structure from the real project -- no fixed profiles
93
+
94
+ The agent starts small (2-4 branches) and grows the tree only when justified.
95
+ Hooks stay thin -- they detect changes and trigger updates, not rebuild the ontology.
96
+
97
+ ## Commands
98
+
99
+ | Command | What it does |
100
+ |---------|-------------|
101
+ | `init` | Set up a project (zero-arg, auto-detects everything) |
102
+ | `sync` | Push memory updates + extract git evidence |
103
+ | `doctor` | Validate setup and report health |
104
+ | `update` | Sync project changes into the knowledge tree |
105
+ | `import` | Import repo history into Evidence/ |
106
+ | `ship` | Validate, sync, commit, push |
107
+ | `setup` | Install global Cursor rules and skills |
108
+ | `global-sync` | Import safe local tooling config |
109
+ | `measure-tokens` | Estimate context token savings |
110
+
111
+ All write commands support `--dry-run`. Use `--json` for machine-readable output.
112
+
113
+ ## Multi-Tool Support
114
+
115
+ `init` detects which tools are present and installs the right bridge files:
116
+
117
+ | Tool | Bridge file | When installed |
118
+ |------|-------------|---------------|
119
+ | Cursor | `.cursor/hooks.json` + `.cursor/rules/agent-knowledge.mdc` | Always (hooks/rules are inert outside Cursor) |
120
+ | Claude | `CLAUDE.md` | When `.claude/` directory is detected |
121
+ | Codex | `.codex/AGENTS.md` | When `.codex/` directory is detected |
122
+
123
+ Multiple tools in the same repo work together.
124
+
125
+ ## Obsidian
126
+
127
+ Open `~/agent-os/projects/<slug>/` as an Obsidian vault. The knowledge graph
128
+ shows all memory areas, evidence, and dashboards connected through wiki-links.
129
+
130
+ Enable **Graph view** in Settings > Core plugins and set
131
+ **Files and links > Use `[[Wikilinks]]`** to ON for the best experience.
132
+
133
+ ## Custom Knowledge Home
134
+
135
+ ```bash
136
+ export AGENT_KNOWLEDGE_HOME=~/my-knowledge
137
+ agent-knowledge init
138
+ ```
139
+
140
+ ## Platform Support
141
+
142
+ - **macOS** and **Linux** are fully supported.
143
+ - **Windows** is not currently supported. The CLI relies on `bash` and POSIX shell
144
+ scripts for most operations.
145
+ - Python 3.9+ is required.
146
+
147
+ ## Development
148
+
149
+ ```bash
150
+ git clone <repo-url>
151
+ cd agent-knowledge
152
+ python -m venv .venv && source .venv/bin/activate
153
+ pip install -e ".[dev]"
154
+ python -m pytest tests/ -q
155
+ ```
@@ -0,0 +1,131 @@
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
+ ## Install
10
+
11
+ ```
12
+ pip install agent-knowledge-cli
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```
18
+ cd your-project
19
+ agent-knowledge init
20
+ ```
21
+
22
+ Open Cursor, Claude, or Codex in the repo -- the agent picks up from there.
23
+
24
+ `init` automatically:
25
+ - infers the project slug from the directory name
26
+ - creates an external knowledge vault at `~/agent-os/projects/<slug>/`
27
+ - symlinks `./agent-knowledge` into the repo as the local handle
28
+ - detects Cursor, Claude, and Codex and installs integration files
29
+ - bootstraps the memory tree and marks onboarding as `pending`
30
+ - prints the prompt to kick off first-time agent ingestion
31
+
32
+ ## How It Works
33
+
34
+ ```
35
+ your-project/
36
+ .agent-project.yaml # project config
37
+ AGENTS.md # instructions agents read on startup
38
+ agent-knowledge/ # symlink -> ~/agent-os/projects/<slug>/
39
+ STATUS.md # onboarding state + sync timestamps
40
+ Memory/
41
+ MEMORY.md # root entrypoint (read first)
42
+ stack.md # flat branch note
43
+ perception/
44
+ perception.md # branch entry (same name as folder)
45
+ fusion.md # subtopic note
46
+ decisions/
47
+ decisions.md # decision log
48
+ Evidence/ # imported/extracted material
49
+ Outputs/ # generated views (never canonical)
50
+ Sessions/ # ephemeral session state
51
+ ```
52
+
53
+ Knowledge lives **outside** the repo so it persists across branches, tools,
54
+ and clones. The symlink gives every tool a stable `./agent-knowledge` path.
55
+
56
+ When an agent opens the repo it reads `AGENTS.md` and `STATUS.md`.
57
+ If onboarding is pending, it inspects the project, imports evidence,
58
+ infers the ontology from the actual repo, and writes curated memory.
59
+ After that, maintenance is automatic.
60
+
61
+ ## Branch Convention
62
+
63
+ The memory tree uses a same-name branch-note convention:
64
+
65
+ - **Flat note** (`stack.md`): for topics with no subtopics
66
+ - **Folder** (`perception/perception.md`): for topics that grow subtopics
67
+ - **Folder name = topic**, entry note = same name as folder
68
+ - **Agents infer** the branch structure from the real project -- no fixed profiles
69
+
70
+ The agent starts small (2-4 branches) and grows the tree only when justified.
71
+ Hooks stay thin -- they detect changes and trigger updates, not rebuild the ontology.
72
+
73
+ ## Commands
74
+
75
+ | Command | What it does |
76
+ |---------|-------------|
77
+ | `init` | Set up a project (zero-arg, auto-detects everything) |
78
+ | `sync` | Push memory updates + extract git evidence |
79
+ | `doctor` | Validate setup and report health |
80
+ | `update` | Sync project changes into the knowledge tree |
81
+ | `import` | Import repo history into Evidence/ |
82
+ | `ship` | Validate, sync, commit, push |
83
+ | `setup` | Install global Cursor rules and skills |
84
+ | `global-sync` | Import safe local tooling config |
85
+ | `measure-tokens` | Estimate context token savings |
86
+
87
+ All write commands support `--dry-run`. Use `--json` for machine-readable output.
88
+
89
+ ## Multi-Tool Support
90
+
91
+ `init` detects which tools are present and installs the right bridge files:
92
+
93
+ | Tool | Bridge file | When installed |
94
+ |------|-------------|---------------|
95
+ | Cursor | `.cursor/hooks.json` + `.cursor/rules/agent-knowledge.mdc` | Always (hooks/rules are inert outside Cursor) |
96
+ | Claude | `CLAUDE.md` | When `.claude/` directory is detected |
97
+ | Codex | `.codex/AGENTS.md` | When `.codex/` directory is detected |
98
+
99
+ Multiple tools in the same repo work together.
100
+
101
+ ## Obsidian
102
+
103
+ Open `~/agent-os/projects/<slug>/` as an Obsidian vault. The knowledge graph
104
+ shows all memory areas, evidence, and dashboards connected through wiki-links.
105
+
106
+ Enable **Graph view** in Settings > Core plugins and set
107
+ **Files and links > Use `[[Wikilinks]]`** to ON for the best experience.
108
+
109
+ ## Custom Knowledge Home
110
+
111
+ ```bash
112
+ export AGENT_KNOWLEDGE_HOME=~/my-knowledge
113
+ agent-knowledge init
114
+ ```
115
+
116
+ ## Platform Support
117
+
118
+ - **macOS** and **Linux** are fully supported.
119
+ - **Windows** is not currently supported. The CLI relies on `bash` and POSIX shell
120
+ scripts for most operations.
121
+ - Python 3.9+ is required.
122
+
123
+ ## Development
124
+
125
+ ```bash
126
+ git clone <repo-url>
127
+ cd agent-knowledge
128
+ python -m venv .venv && source .venv/bin/activate
129
+ pip install -e ".[dev]"
130
+ python -m pytest tests/ -q
131
+ ```
@@ -0,0 +1,44 @@
1
+ # AI Assistant Global Rules
2
+
3
+ ## Communication Style
4
+
5
+ Think deeply, act decisively, speak briefly.
6
+
7
+ - Execute over explain — let code and results speak
8
+ - Lead with the action or answer, not the reasoning
9
+ - No preambles, filler text, or summaries of what was just done
10
+ - Only detailed explanations when explicitly requested
11
+ - Short, direct sentences over long explanations
12
+
13
+ ## Prohibitions
14
+
15
+ - No emojis or icons in code, logs, or responses — plain text only
16
+ - Never create .md, README, CHANGELOG, or documentation files unless explicitly asked
17
+ - Exception: internal memory/session files are fine to create and update freely
18
+
19
+ ## Workflow
20
+
21
+ - Plan before any non-trivial task (3+ steps or architectural decisions)
22
+ - Use subagents liberally to keep the main context window clean and for parallel work
23
+ - After any user correction: record the pattern to prevent repeating it
24
+ - Never mark a task complete without proving it works
25
+ - For non-trivial changes: ask "is there a more elegant way?" before presenting
26
+ - When given a bug report: fix it autonomously — no hand-holding needed
27
+ - When the user describes a constraint or says something won't work: stop and accept it. One confirmation attempt max — do not re-discover what the user already knows
28
+
29
+ ## Code Quality
30
+
31
+ - Simplicity first: make every change as simple as possible, impact minimal code
32
+ - No laziness: find root causes, no temporary fixes, senior developer standards
33
+ - Minimal impact: only touch what is necessary, avoid introducing bugs
34
+ - No ORMs unless the project already uses one
35
+ - No new dependencies without asking first
36
+
37
+ ## Memory
38
+
39
+ - Save stable patterns, preferences, and architectural decisions to memory files
40
+ - Keep the Memory/MEMORY.md note concise (truncated after ~200 lines); put detail in branch files
41
+ - Update or remove memories that turn out to be wrong or outdated
42
+ - Never save session-specific, in-progress, or speculative information
43
+ - When the user asks to remember something: save it immediately
44
+ - When the user asks to forget something: remove it immediately
@@ -0,0 +1,46 @@
1
+ # Project: <Name>
2
+
3
+ <!-- Drop this file at the project root as CLAUDE.md -->
4
+ <!-- It is read automatically by Claude Code at the start of every session -->
5
+ <!-- Global rules in ~/.claude/CLAUDE.md are also loaded — no need to repeat them here -->
6
+
7
+ ## Stack
8
+
9
+ - <language/runtime>
10
+ - <framework>
11
+ - <database>
12
+ - <key libraries>
13
+
14
+ ## Key Directories
15
+
16
+ - `src/` — <description>
17
+ - `tests/` — <description>
18
+
19
+ ## Conventions
20
+
21
+ - <naming conventions>
22
+ - <patterns to follow>
23
+ - <patterns to avoid>
24
+
25
+ ## What NOT to do
26
+
27
+ - Do not install <X> — we use <Y> instead
28
+ - Do not restructure <X> without asking
29
+ - Do not commit secrets — use .env.template as reference
30
+
31
+ ## When unsure
32
+
33
+ - Search the codebase first. Reuse existing patterns.
34
+ - Ask before creating new packages or major abstractions.
35
+ - Read docs in `docs/` or `agent-knowledge/` before implementing.
36
+
37
+ ## Shared Memory
38
+
39
+ Persistent project memory lives at `agent-knowledge/Memory/MEMORY.md`.
40
+ The local `agent-knowledge/` path should point to the real dedicated knowledge folder.
41
+ Read it at the start of each session. Write back after meaningful changes.
42
+
43
+ - If `agent-knowledge/Memory/MEMORY.md` is missing: run `scripts/bootstrap-memory-tree.sh .`
44
+ - After any architectural decision: use the `decision-recording` skill
45
+ - After any meaningful state change: follow the `memory-writeback` rule
46
+ - To backfill from git/docs history: run `scripts/import-agent-history.sh .`
@@ -0,0 +1,85 @@
1
+ #!/bin/bash
2
+ #
3
+ # Install Claude Code global rules into ~/.claude/CLAUDE.md
4
+ #
5
+ # Usage:
6
+ # ./install.sh # install global rules
7
+ # ./install.sh /path/to/project # also install project template into project root
8
+ #
9
+ # The global rules are appended under a managed section marker so re-running
10
+ # this script is safe (it replaces the section, not appends again).
11
+ #
12
+
13
+ set -euo pipefail
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
16
+ CLAUDE_DIR="$HOME/.claude"
17
+ GLOBAL_SOURCE="$SCRIPT_DIR/../global.md"
18
+ GLOBAL_TARGET="$CLAUDE_DIR/CLAUDE.md"
19
+ PROJECT="${1:-}"
20
+
21
+ MARKER_START="<!-- agents-rules:global:start -->"
22
+ MARKER_END="<!-- agents-rules:global:end -->"
23
+
24
+ mkdir -p "$CLAUDE_DIR"
25
+
26
+ install_global() {
27
+ local content
28
+ content="$(cat "$GLOBAL_SOURCE")"
29
+
30
+ if [ -f "$GLOBAL_TARGET" ]; then
31
+ # Remove existing managed section if present
32
+ if grep -q "$MARKER_START" "$GLOBAL_TARGET" 2>/dev/null; then
33
+ # Strip from marker-start to marker-end inclusive
34
+ local tmp
35
+ tmp="$(mktemp)"
36
+ awk "/$MARKER_START/{flag=1} !flag{print} /$MARKER_END/{flag=0}" "$GLOBAL_TARGET" > "$tmp"
37
+ mv "$tmp" "$GLOBAL_TARGET"
38
+ echo " updated existing section in $GLOBAL_TARGET"
39
+ else
40
+ echo " appending to existing $GLOBAL_TARGET"
41
+ echo "" >> "$GLOBAL_TARGET"
42
+ fi
43
+ else
44
+ echo " creating $GLOBAL_TARGET"
45
+ fi
46
+
47
+ {
48
+ echo "$MARKER_START"
49
+ echo "$content"
50
+ echo "$MARKER_END"
51
+ } >> "$GLOBAL_TARGET"
52
+
53
+ echo " global rules installed -> $GLOBAL_TARGET"
54
+ }
55
+
56
+ install_project_template() {
57
+ local project_dir
58
+ project_dir="$(cd "$1" && pwd)"
59
+ local target="$project_dir/CLAUDE.md"
60
+ local source="$SCRIPT_DIR/../project-template.md"
61
+
62
+ if [ -f "$target" ]; then
63
+ echo " $target already exists — skipping (edit manually)"
64
+ else
65
+ cp "$source" "$target"
66
+ echo " project template installed -> $target"
67
+ echo " Edit CLAUDE.md with your project-specific rules"
68
+ fi
69
+ }
70
+
71
+ echo "Installing Claude Code rules..."
72
+ echo ""
73
+
74
+ install_global
75
+
76
+ if [ -n "$PROJECT" ]; then
77
+ install_project_template "$PROJECT"
78
+ fi
79
+
80
+ echo ""
81
+ echo "Done."
82
+ echo ""
83
+ echo "Claude Code reads:"
84
+ echo " ~/.claude/CLAUDE.md <- global rules (all projects)"
85
+ echo " <project>/CLAUDE.md <- project rules (this project only)"
@@ -0,0 +1,21 @@
1
+ # Doctor
2
+
3
+ Doctor is the quick troubleshooting entrypoint for a connected project knowledge setup.
4
+
5
+ ## Behavior
6
+
7
+ - run knowledge validation
8
+ - verify the local `./agent-knowledge` pointer and external source-of-truth path
9
+ - check project setup files such as `.agent-project.yaml`, `AGENTS.md`, and optional repo-local hooks
10
+ - summarize health warnings and the current operational state
11
+
12
+ ## Safety
13
+
14
+ - read-mostly command
15
+ - may refresh `agent-knowledge/STATUS.md` unless `--dry-run` is used
16
+
17
+ ## Expected Script Entry Point
18
+
19
+ ```bash
20
+ scripts/doctor.sh --project /path/to/project
21
+ ```
@@ -0,0 +1,27 @@
1
+ # Global Knowledge Sync
2
+
3
+ Global knowledge sync builds a project-scoped tooling knowledge view from safe,
4
+ allowlisted user-level tool surfaces. It still writes through `./agent-knowledge`,
5
+ which should resolve to the external project knowledge folder.
6
+
7
+ ## Behavior
8
+
9
+ - scan allowlisted local configuration sources such as `~/.claude/`, `~/.codex/`, and optional safe Cursor customizations
10
+ - skip opaque caches, auth/session surfaces, and suspicious secret-bearing files
11
+ - redact sensitive lines before writing evidence
12
+ - write redacted imports under `agent-knowledge/Evidence/tooling/`
13
+ - write curated summaries under `agent-knowledge/Memory/tooling/`
14
+ - update `agent-knowledge/STATUS.md`
15
+
16
+ ## Safety
17
+
18
+ - use `--dry-run` to preview writes
19
+ - reruns should be idempotent
20
+ - summaries must report both scanned sources and safety skips
21
+
22
+ ## Expected Script Entry Point
23
+
24
+ ```bash
25
+ scripts/global-knowledge-sync.sh --project /path/to/project
26
+ scripts/global-knowledge-sync.sh --project /path/to/project --dry-run
27
+ ```
@@ -0,0 +1,26 @@
1
+ # Graphify Sync
2
+
3
+ Graphify sync is the optional structural-discovery import flow for graph-style project exports.
4
+ It writes through `./agent-knowledge`, but keeps imported graph structure in `Evidence/` and `Outputs/`, not in durable memory.
5
+
6
+ ## Behavior
7
+
8
+ - detect whether `graphify` or equivalent structural export artifacts are available
9
+ - import safe graph/report/json artifacts into `agent-knowledge/Evidence/imports/graphify/`
10
+ - generate concise structural summaries under `agent-knowledge/Outputs/graphify/`
11
+ - tag imported material with confidence metadata such as `EXTRACTED` or `INFERRED`
12
+ - summarize what was imported, what was cached, and what was skipped
13
+
14
+ ## Safety
15
+
16
+ - optional only; missing graph tooling must not fail the project knowledge system
17
+ - use `--dry-run` to preview all writes
18
+ - imported graph outputs are evidence first and are not promoted into `Memory/` automatically
19
+
20
+ ## Expected Script Entry Point
21
+
22
+ ```bash
23
+ scripts/graphify-sync.sh --project /path/to/project
24
+ scripts/graphify-sync.sh --project /path/to/project --source /path/to/graphify-export
25
+ scripts/graphify-sync.sh --project /path/to/project --dry-run
26
+ ```
@@ -0,0 +1,26 @@
1
+ # Knowledge Sync
2
+
3
+ Knowledge sync is the connected-project maintenance flow for the adaptive memory system. It writes through `./agent-knowledge`, which should resolve to the external project knowledge folder.
4
+
5
+ ## Behavior
6
+
7
+ - inspect current repo changes
8
+ - classify touched files into the relevant `agent-knowledge/Memory/` branch notes
9
+ - append durable recent-change entries when knowledge meaningfully changed
10
+ - optionally record a decision note when explicitly requested
11
+ - refresh raw and imported evidence without treating it as curated truth
12
+ - update `agent-knowledge/STATUS.md`
13
+
14
+ ## Safety
15
+
16
+ - use `--dry-run` to preview all file writes
17
+ - idempotent reruns should not duplicate recent-change bullets
18
+ - sessions and evidence stay separate from durable memory
19
+
20
+ ## Expected Script Entry Point
21
+
22
+ ```bash
23
+ scripts/update-knowledge.sh --project /path/to/project
24
+ scripts/update-knowledge.sh --project /path/to/project --decision-title "Adopt X"
25
+ scripts/update-knowledge.sh --project /path/to/project --dry-run
26
+ ```
@@ -0,0 +1,29 @@
1
+ # Ship
2
+
3
+ Ship is the operational release-prep flow for a connected project repo.
4
+
5
+ ## Behavior
6
+
7
+ - inspect git status and current branch
8
+ - refuse to continue on detached HEAD or merge conflicts
9
+ - run detected validation commands for the repo
10
+ - run knowledge sync and compaction before commit
11
+ - stage repo-local changes
12
+ - generate or accept a concise commit message
13
+ - commit and push when possible
14
+ - optionally open a PR when requested
15
+
16
+ ## Safety
17
+
18
+ - use `--dry-run` to preview validations, git actions, and knowledge updates
19
+ - knowledge updates still run through `./agent-knowledge`; the script does not convert the system into repo-local storage
20
+ - if the real knowledge vault lives outside the repo, the script reports that instead of pretending to stage it
21
+ - reruns are no-op when nothing changed
22
+
23
+ ## Expected Script Entry Point
24
+
25
+ ```bash
26
+ scripts/ship.sh --project /path/to/project
27
+ scripts/ship.sh --project /path/to/project --message "chore: ship update"
28
+ scripts/ship.sh --project /path/to/project --open-pr --dry-run
29
+ ```