evo-ak 0.1.0__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 (54) hide show
  1. evo_ak-0.1.0/LICENSE +202 -0
  2. evo_ak-0.1.0/PKG-INFO +163 -0
  3. evo_ak-0.1.0/README.md +141 -0
  4. evo_ak-0.1.0/evo_agents/__init__.py +3 -0
  5. evo_ak-0.1.0/evo_agents/__main__.py +3 -0
  6. evo_ak-0.1.0/evo_agents/cli.py +69 -0
  7. evo_ak-0.1.0/evo_agents/harness/__init__.py +415 -0
  8. evo_ak-0.1.0/evo_agents/harness/schemas/contracts.schema.json +57 -0
  9. evo_ak-0.1.0/evo_agents/harness/schemas/harness.schema.json +40 -0
  10. evo_ak-0.1.0/evo_agents/harness/schemas/knowledge.schema.json +289 -0
  11. evo_ak-0.1.0/evo_agents/harness/schemas/plan.schema.json +202 -0
  12. evo_ak-0.1.0/evo_agents/kg/__init__.py +1 -0
  13. evo_ak-0.1.0/evo_agents/kg/audit.py +124 -0
  14. evo_ak-0.1.0/evo_agents/kg/build.py +488 -0
  15. evo_ak-0.1.0/evo_agents/kg/cli.py +360 -0
  16. evo_ak-0.1.0/evo_agents/kg/cli_graph.py +86 -0
  17. evo_ak-0.1.0/evo_agents/kg/connectors/__init__.py +1 -0
  18. evo_ak-0.1.0/evo_agents/kg/connectors/_files.py +209 -0
  19. evo_ak-0.1.0/evo_agents/kg/connectors/_git.py +113 -0
  20. evo_ak-0.1.0/evo_agents/kg/connectors/git.py +102 -0
  21. evo_ak-0.1.0/evo_agents/kg/connectors/harness.py +151 -0
  22. evo_ak-0.1.0/evo_agents/kg/corpus.py +360 -0
  23. evo_ak-0.1.0/evo_agents/kg/extract/__init__.py +1 -0
  24. evo_ak-0.1.0/evo_agents/kg/extract/graphify.py +137 -0
  25. evo_ak-0.1.0/evo_agents/kg/extract/python.py +109 -0
  26. evo_ak-0.1.0/evo_agents/kg/ids.py +63 -0
  27. evo_ak-0.1.0/evo_agents/kg/memo.py +78 -0
  28. evo_ak-0.1.0/evo_agents/kg/pipeline/__init__.py +1 -0
  29. evo_ak-0.1.0/evo_agents/kg/pipeline/binding.py +109 -0
  30. evo_ak-0.1.0/evo_agents/kg/pipeline/link.py +434 -0
  31. evo_ak-0.1.0/evo_agents/kg/pipeline/stages.py +536 -0
  32. evo_ak-0.1.0/evo_agents/kg/policy.py +144 -0
  33. evo_ak-0.1.0/evo_agents/kg/project.py +240 -0
  34. evo_ak-0.1.0/evo_agents/kg/protocol/__init__.py +315 -0
  35. evo_ak-0.1.0/evo_agents/kg/protocol/conformance.py +185 -0
  36. evo_ak-0.1.0/evo_agents/kg/protocol/runner.py +188 -0
  37. evo_ak-0.1.0/evo_agents/kg/schedule.py +115 -0
  38. evo_ak-0.1.0/evo_agents/kg/schema.py +104 -0
  39. evo_ak-0.1.0/evo_agents/kg/search_hint.py +383 -0
  40. evo_ak-0.1.0/evo_agents/kg/serve.py +892 -0
  41. evo_ak-0.1.0/evo_agents/kg/sessions.py +239 -0
  42. evo_ak-0.1.0/evo_agents/kg/status.py +174 -0
  43. evo_ak-0.1.0/evo_agents/kg/store.py +555 -0
  44. evo_ak-0.1.0/evo_agents/kg/sync.py +391 -0
  45. evo_ak-0.1.0/evo_agents/kg/text.py +85 -0
  46. evo_ak-0.1.0/evo_agents/schema.py +154 -0
  47. evo_ak-0.1.0/evo_ak.egg-info/PKG-INFO +163 -0
  48. evo_ak-0.1.0/evo_ak.egg-info/SOURCES.txt +52 -0
  49. evo_ak-0.1.0/evo_ak.egg-info/dependency_links.txt +1 -0
  50. evo_ak-0.1.0/evo_ak.egg-info/entry_points.txt +6 -0
  51. evo_ak-0.1.0/evo_ak.egg-info/requires.txt +8 -0
  52. evo_ak-0.1.0/evo_ak.egg-info/top_level.txt +1 -0
  53. evo_ak-0.1.0/pyproject.toml +54 -0
  54. evo_ak-0.1.0/setup.cfg +4 -0
evo_ak-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
evo_ak-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: evo-ak
3
+ Version: 0.1.0
4
+ Summary: Shared tooling for agent harnesses: harness schema, multi-source knowledge graph, Claude Code plugins
5
+ Author: maycuatroi
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/maycuatroi1/evo-agents
8
+ Keywords: agents,harness,knowledge-graph,mcp,claude-code
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Topic :: Software Development
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: PyYAML>=6.0
16
+ Provides-Extra: test
17
+ Requires-Dist: pytest>=8; extra == "test"
18
+ Requires-Dist: ruff>=0.6; extra == "test"
19
+ Provides-Extra: graphify
20
+ Requires-Dist: graphifyy==0.9.73; extra == "graphify"
21
+ Dynamic: license-file
22
+
23
+ # evo-agents
24
+
25
+ Shared tooling for agent harnesses: a cluster of repos plus the manifest, plans and documents that
26
+ tell a coding agent how the cluster fits together.
27
+
28
+ The first piece is a multi-source knowledge graph. Connectors read git repos, the harness itself,
29
+ wikis and project CLIs, speak one JSON Lines protocol (`kg/1`), and feed an append-only log per
30
+ project. A deterministic pipeline turns that log into a SQLite graph that agents query over MCP.
31
+ Every node and edge carries provenance and a sensitivity label, and a session only sees what its
32
+ clearance allows.
33
+
34
+ Status: early prototype. Interfaces will change.
35
+
36
+ ## Install
37
+
38
+ ```sh
39
+ uv tool install evo-ak # or: pip install evo-ak (PyPI name; the command is evo-agents)
40
+ uv tool install git+https://github.com/maycuatroi1/evo-agents # unreleased main
41
+ # or, from a checkout: python -m pip install -e '.[test]'
42
+ ```
43
+
44
+ The core needs Python 3.10+ and PyYAML; nothing else.
45
+
46
+ ## Quick start
47
+
48
+ A harness opts in with a `knowledge.yaml` next to its `harness.yaml`:
49
+
50
+ ```yaml
51
+ version: 1
52
+ project: demo
53
+ policy:
54
+ levels: [public, internal, customer, secret]
55
+ sinks:
56
+ - id: claude-code@anthropic
57
+ kind: agent-session
58
+ clearance: {level: internal}
59
+ sources:
60
+ - id: harness # plans, contracts, bindings, docs of the harness itself
61
+ connector: harness
62
+ label: {level: internal, integrity: U}
63
+ - id: app # a repo declared in harness.yaml
64
+ connector: git
65
+ repo: app
66
+ refresh: 1h # due for kg sync --due once an hour
67
+ label: {level: internal, integrity: U}
68
+ - id: wiki # any command that speaks kg/1
69
+ connector: exec
70
+ command: [my-cli, kg-connector, wiki]
71
+ credentials: [{key: my.wiki.token, env: WIKI_TOKEN}]
72
+ label: {level: customer, integrity: U}
73
+ identifiers:
74
+ - kind: UseCase
75
+ pattern: '\bKB-\d{2}\b'
76
+ ```
77
+
78
+ A markdown file whose frontmatter `id:` matches an identifier pattern is where that code is defined;
79
+ a copy says `derived_from:` in its frontmatter, and `kg status` lists codes defined in more than one place.
80
+
81
+ Then, from the harness:
82
+
83
+ ```sh
84
+ evo-agents harness validate # schema and reference checks for every harness file
85
+ evo-agents kg sync --build # run connectors, build the graph
86
+ evo-agents kg status # freshness, coverage and held deletions per source
87
+ evo-agents kg build --verify # rebuild from scratch and compare hashes
88
+ evo-agents kg query kg_search "KB-01"
89
+ evo-agents kg query kg_impact --arg 'paths=["app:src/search.py"]'
90
+ ```
91
+
92
+ Corpus and graph live in `~/.evo/kg/<project>/` (override with `EVO_KG_HOME`), never in a repo. Every
93
+ source sync and every build appends one line to `audit.jsonl` there: ids, times, counts and versions,
94
+ never item content.
95
+
96
+ To keep graphs fresh, give sources a `refresh` interval (`30m`, `6h`, `1d`). `kg sync --due` runs only
97
+ the sources whose interval has passed since their last ok run; `--all` does that for every project that
98
+ has synced on this machine. On macOS, `kg schedule install` loads a LaunchAgent that runs
99
+ `kg sync --due --all --build` every hour (`kg schedule print` shows the plist, `kg schedule uninstall`
100
+ removes it; output goes to `~/.evo/kg/schedule.log`).
101
+
102
+ ## Using it from Claude Code
103
+
104
+ ```sh
105
+ claude plugin marketplace add https://github.com/maycuatroi1/evo-agents
106
+ claude plugin install evo-kg@evo-agents
107
+ ```
108
+
109
+ The plugin registers the MCP server `evo-kg`, a `using-project-graph` skill, and three hooks. The
110
+ server binds to the project of the session directory; pass `--project` in `.mcp.json` to pin one, or
111
+ run `evo-agents kg bind --project NAME DIR` once to tie a directory and everything below it to a project
112
+ (`kg bind --list` and `kg bind --remove DIR` manage those bindings).
113
+
114
+ | Tool | Use |
115
+ |---|---|
116
+ | `kg_search` | find ids by name, code, path or words |
117
+ | `kg_context` | connected subgraph around a question or ids, within a token budget |
118
+ | `kg_node` | one node: properties, evidence, edges |
119
+ | `kg_path` | shortest path between two ids, or the trace chains from one (requirement, step, code, test) |
120
+ | `kg_impact` | what depends on ids, `repo:path` files or a unified diff, before you change them |
121
+ | `kg_status` | bound project, clearance, snapshot age, coverage per source, session label |
122
+ | `kg_more` | continue a truncated result |
123
+
124
+ Hooks:
125
+
126
+ - SessionStart prints a short note: the bound project and the snapshot age.
127
+ - PostToolUse, after every evo-kg call, joins the labels of what the result revealed into a session
128
+ label under `~/.evo/kg/sessions/`. It only rises; `kg_status` shows it.
129
+ - PreToolUse, before Grep, Glob, or `rg` or `grep` in Bash, may add a note with the ids of graph
130
+ nodes named like the search. It never allows or blocks the call. Set `EVO_KG_GREP_HINTS=0` to turn it
131
+ off.
132
+
133
+ The plugin needs [uv](https://docs.astral.sh/uv/) on `PATH` and pins the release it runs: the server
134
+ starts with `uvx --from evo-ak==0.1.0 evo-agents`, which downloads and caches that version on first start. The hooks
135
+ run `uvx --offline --from evo-ak==0.1.0 evo-agents`, so they never wait on the network; they stay silent when `uvx`
136
+ is missing or until the server has cached the package.
137
+
138
+ ## Writing a connector
139
+
140
+ A connector is a generator in process or any executable. It writes JSON objects, one per line:
141
+ `hello` first, then `item`, `tombstone`, `listing`, `state`, `error`, `log`, and `closed` last.
142
+ Item IDs are `<source>:<kind>:<native key>`; every item carries a revision and a content hash over
143
+ canonical JSON. Deletions are only inferred from a scoped `listing` that ends with
144
+ `complete: true`, so a connector that dies half-way never deletes anything.
145
+
146
+ ```sh
147
+ evo-agents kg connector test -- my-cli kg-connector wiki --fixture tests/fixtures/wiki
148
+ ```
149
+
150
+ checks protocol, determinism, replay and permutation, truncated listings, golden output and labels.
151
+
152
+ ## Layout
153
+
154
+ ```
155
+ evo_agents/
156
+ harness/ schema and loader for harness.yaml, knowledge.yaml, contracts.yaml, plans
157
+ kg/ protocol, connectors, corpus, pipeline, store, policy, MCP server
158
+ plugins/ Claude Code marketplace (plugin evo-kg)
159
+ ```
160
+
161
+ ## License
162
+
163
+ Apache-2.0. See [LICENSE](LICENSE).
evo_ak-0.1.0/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # evo-agents
2
+
3
+ Shared tooling for agent harnesses: a cluster of repos plus the manifest, plans and documents that
4
+ tell a coding agent how the cluster fits together.
5
+
6
+ The first piece is a multi-source knowledge graph. Connectors read git repos, the harness itself,
7
+ wikis and project CLIs, speak one JSON Lines protocol (`kg/1`), and feed an append-only log per
8
+ project. A deterministic pipeline turns that log into a SQLite graph that agents query over MCP.
9
+ Every node and edge carries provenance and a sensitivity label, and a session only sees what its
10
+ clearance allows.
11
+
12
+ Status: early prototype. Interfaces will change.
13
+
14
+ ## Install
15
+
16
+ ```sh
17
+ uv tool install evo-ak # or: pip install evo-ak (PyPI name; the command is evo-agents)
18
+ uv tool install git+https://github.com/maycuatroi1/evo-agents # unreleased main
19
+ # or, from a checkout: python -m pip install -e '.[test]'
20
+ ```
21
+
22
+ The core needs Python 3.10+ and PyYAML; nothing else.
23
+
24
+ ## Quick start
25
+
26
+ A harness opts in with a `knowledge.yaml` next to its `harness.yaml`:
27
+
28
+ ```yaml
29
+ version: 1
30
+ project: demo
31
+ policy:
32
+ levels: [public, internal, customer, secret]
33
+ sinks:
34
+ - id: claude-code@anthropic
35
+ kind: agent-session
36
+ clearance: {level: internal}
37
+ sources:
38
+ - id: harness # plans, contracts, bindings, docs of the harness itself
39
+ connector: harness
40
+ label: {level: internal, integrity: U}
41
+ - id: app # a repo declared in harness.yaml
42
+ connector: git
43
+ repo: app
44
+ refresh: 1h # due for kg sync --due once an hour
45
+ label: {level: internal, integrity: U}
46
+ - id: wiki # any command that speaks kg/1
47
+ connector: exec
48
+ command: [my-cli, kg-connector, wiki]
49
+ credentials: [{key: my.wiki.token, env: WIKI_TOKEN}]
50
+ label: {level: customer, integrity: U}
51
+ identifiers:
52
+ - kind: UseCase
53
+ pattern: '\bKB-\d{2}\b'
54
+ ```
55
+
56
+ A markdown file whose frontmatter `id:` matches an identifier pattern is where that code is defined;
57
+ a copy says `derived_from:` in its frontmatter, and `kg status` lists codes defined in more than one place.
58
+
59
+ Then, from the harness:
60
+
61
+ ```sh
62
+ evo-agents harness validate # schema and reference checks for every harness file
63
+ evo-agents kg sync --build # run connectors, build the graph
64
+ evo-agents kg status # freshness, coverage and held deletions per source
65
+ evo-agents kg build --verify # rebuild from scratch and compare hashes
66
+ evo-agents kg query kg_search "KB-01"
67
+ evo-agents kg query kg_impact --arg 'paths=["app:src/search.py"]'
68
+ ```
69
+
70
+ Corpus and graph live in `~/.evo/kg/<project>/` (override with `EVO_KG_HOME`), never in a repo. Every
71
+ source sync and every build appends one line to `audit.jsonl` there: ids, times, counts and versions,
72
+ never item content.
73
+
74
+ To keep graphs fresh, give sources a `refresh` interval (`30m`, `6h`, `1d`). `kg sync --due` runs only
75
+ the sources whose interval has passed since their last ok run; `--all` does that for every project that
76
+ has synced on this machine. On macOS, `kg schedule install` loads a LaunchAgent that runs
77
+ `kg sync --due --all --build` every hour (`kg schedule print` shows the plist, `kg schedule uninstall`
78
+ removes it; output goes to `~/.evo/kg/schedule.log`).
79
+
80
+ ## Using it from Claude Code
81
+
82
+ ```sh
83
+ claude plugin marketplace add https://github.com/maycuatroi1/evo-agents
84
+ claude plugin install evo-kg@evo-agents
85
+ ```
86
+
87
+ The plugin registers the MCP server `evo-kg`, a `using-project-graph` skill, and three hooks. The
88
+ server binds to the project of the session directory; pass `--project` in `.mcp.json` to pin one, or
89
+ run `evo-agents kg bind --project NAME DIR` once to tie a directory and everything below it to a project
90
+ (`kg bind --list` and `kg bind --remove DIR` manage those bindings).
91
+
92
+ | Tool | Use |
93
+ |---|---|
94
+ | `kg_search` | find ids by name, code, path or words |
95
+ | `kg_context` | connected subgraph around a question or ids, within a token budget |
96
+ | `kg_node` | one node: properties, evidence, edges |
97
+ | `kg_path` | shortest path between two ids, or the trace chains from one (requirement, step, code, test) |
98
+ | `kg_impact` | what depends on ids, `repo:path` files or a unified diff, before you change them |
99
+ | `kg_status` | bound project, clearance, snapshot age, coverage per source, session label |
100
+ | `kg_more` | continue a truncated result |
101
+
102
+ Hooks:
103
+
104
+ - SessionStart prints a short note: the bound project and the snapshot age.
105
+ - PostToolUse, after every evo-kg call, joins the labels of what the result revealed into a session
106
+ label under `~/.evo/kg/sessions/`. It only rises; `kg_status` shows it.
107
+ - PreToolUse, before Grep, Glob, or `rg` or `grep` in Bash, may add a note with the ids of graph
108
+ nodes named like the search. It never allows or blocks the call. Set `EVO_KG_GREP_HINTS=0` to turn it
109
+ off.
110
+
111
+ The plugin needs [uv](https://docs.astral.sh/uv/) on `PATH` and pins the release it runs: the server
112
+ starts with `uvx --from evo-ak==0.1.0 evo-agents`, which downloads and caches that version on first start. The hooks
113
+ run `uvx --offline --from evo-ak==0.1.0 evo-agents`, so they never wait on the network; they stay silent when `uvx`
114
+ is missing or until the server has cached the package.
115
+
116
+ ## Writing a connector
117
+
118
+ A connector is a generator in process or any executable. It writes JSON objects, one per line:
119
+ `hello` first, then `item`, `tombstone`, `listing`, `state`, `error`, `log`, and `closed` last.
120
+ Item IDs are `<source>:<kind>:<native key>`; every item carries a revision and a content hash over
121
+ canonical JSON. Deletions are only inferred from a scoped `listing` that ends with
122
+ `complete: true`, so a connector that dies half-way never deletes anything.
123
+
124
+ ```sh
125
+ evo-agents kg connector test -- my-cli kg-connector wiki --fixture tests/fixtures/wiki
126
+ ```
127
+
128
+ checks protocol, determinism, replay and permutation, truncated listings, golden output and labels.
129
+
130
+ ## Layout
131
+
132
+ ```
133
+ evo_agents/
134
+ harness/ schema and loader for harness.yaml, knowledge.yaml, contracts.yaml, plans
135
+ kg/ protocol, connectors, corpus, pipeline, store, policy, MCP server
136
+ plugins/ Claude Code marketplace (plugin evo-kg)
137
+ ```
138
+
139
+ ## License
140
+
141
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,3 @@
1
+ """Shared tooling for agent harnesses."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from evo_agents.cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,69 @@
1
+ """Command line entry point: ``evo-agents``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import sys
8
+ from pathlib import Path
9
+
10
+ from evo_agents import __version__
11
+ from evo_agents.harness import validate_harness
12
+ from evo_agents.schema import errors
13
+
14
+
15
+ def _harness_validate(args) -> int:
16
+ targets = args.paths or [str(Path.cwd())]
17
+ reports = []
18
+ for target in targets:
19
+ reports.extend(validate_harness(target))
20
+ failed = [r for r in reports if not r.ok]
21
+ if args.json:
22
+ print(json.dumps({"ok": not failed, "files": [r.to_json() for r in reports]}, ensure_ascii=False, indent=2))
23
+ return 1 if failed else 0
24
+ for report in reports:
25
+ errs = errors(report.issues)
26
+ warns = [i for i in report.issues if i.severity == "warning"]
27
+ mark = "OK " if report.ok else "FAIL"
28
+ print(f"{mark} {report.kind:<9} {report.path} ({len(errs)} error(s), {len(warns)} warning(s))")
29
+ shown = report.issues if args.verbose else errs + warns[:5]
30
+ for issue in shown:
31
+ print(f" {issue}")
32
+ if not args.verbose and len(warns) > 5:
33
+ print(f" ... {len(warns) - 5} more warning(s); use -v to see all")
34
+ print(f"{len(reports)} file(s), {len(failed)} with errors")
35
+ return 1 if failed else 0
36
+
37
+
38
+ def build_parser() -> argparse.ArgumentParser:
39
+ parser = argparse.ArgumentParser(prog="evo-agents", description="Shared tooling for agent harnesses.")
40
+ parser.add_argument("--version", action="version", version=f"evo-agents {__version__}")
41
+ sub = parser.add_subparsers(dest="group", required=True)
42
+
43
+ harness = sub.add_parser("harness", help="read and validate harness manifests")
44
+ hsub = harness.add_subparsers(dest="command", required=True)
45
+ validate = hsub.add_parser("validate", help="validate harness.yaml, contracts.yaml, knowledge.yaml and plans")
46
+ validate.add_argument("paths", nargs="*", help="harness roots (default: the one containing the cwd)")
47
+ validate.add_argument("--json", action="store_true", help="machine-readable output")
48
+ validate.add_argument("-v", "--verbose", action="store_true", help="show every warning")
49
+ validate.set_defaults(func=_harness_validate)
50
+
51
+ from evo_agents.kg.cli import register as register_kg
52
+
53
+ register_kg(sub)
54
+ return parser
55
+
56
+
57
+ def main(argv: list[str] | None = None) -> int:
58
+ parser = build_parser()
59
+ args = parser.parse_args(argv)
60
+ try:
61
+ return int(args.func(args) or 0)
62
+ except KeyboardInterrupt:
63
+ return 130
64
+ except BrokenPipeError:
65
+ return 0
66
+
67
+
68
+ if __name__ == "__main__":
69
+ sys.exit(main())