efaimo 0.1.0

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 (75) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +6 -0
  4. package/README.md +281 -0
  5. package/SKILL.md +57 -0
  6. package/dist/check/check.d.ts +31 -0
  7. package/dist/check/check.js +77 -0
  8. package/dist/cli.d.ts +2 -0
  9. package/dist/cli.js +372 -0
  10. package/dist/clients/introspect.d.ts +8 -0
  11. package/dist/clients/introspect.js +198 -0
  12. package/dist/clients/rawprobe.d.ts +69 -0
  13. package/dist/clients/rawprobe.js +597 -0
  14. package/dist/clients/stateless.d.ts +7 -0
  15. package/dist/clients/stateless.js +121 -0
  16. package/dist/core/engine.d.ts +6 -0
  17. package/dist/core/engine.js +17 -0
  18. package/dist/core/grade.d.ts +8 -0
  19. package/dist/core/grade.js +19 -0
  20. package/dist/core/types.d.ts +243 -0
  21. package/dist/core/types.js +1 -0
  22. package/dist/index.d.ts +16 -0
  23. package/dist/index.js +26 -0
  24. package/dist/mcp/server.d.ts +3 -0
  25. package/dist/mcp/server.js +88 -0
  26. package/dist/reporters/badge.d.ts +12 -0
  27. package/dist/reporters/badge.js +37 -0
  28. package/dist/reporters/json.d.ts +1 -0
  29. package/dist/reporters/json.js +10 -0
  30. package/dist/reporters/markdown.d.ts +7 -0
  31. package/dist/reporters/markdown.js +121 -0
  32. package/dist/reporters/pretty.d.ts +15 -0
  33. package/dist/reporters/pretty.js +221 -0
  34. package/dist/rules/injection.d.ts +20 -0
  35. package/dist/rules/injection.js +106 -0
  36. package/dist/rules/mcp/index.d.ts +4 -0
  37. package/dist/rules/mcp/index.js +643 -0
  38. package/dist/rules/skill/index.d.ts +2 -0
  39. package/dist/rules/skill/index.js +279 -0
  40. package/dist/skills/parse.d.ts +4 -0
  41. package/dist/skills/parse.js +113 -0
  42. package/dist/targets/clientConfigs.d.ts +17 -0
  43. package/dist/targets/clientConfigs.js +110 -0
  44. package/dist/targets/repoScan.d.ts +2 -0
  45. package/dist/targets/repoScan.js +0 -0
  46. package/dist/targets/resolve.d.ts +28 -0
  47. package/dist/targets/resolve.js +48 -0
  48. package/dist/testing/anthropicRunner.d.ts +6 -0
  49. package/dist/testing/anthropicRunner.js +33 -0
  50. package/dist/testing/harness.d.ts +45 -0
  51. package/dist/testing/harness.js +96 -0
  52. package/dist/testing/openaiRunner.d.ts +12 -0
  53. package/dist/testing/openaiRunner.js +40 -0
  54. package/dist/util/childEnv.d.ts +1 -0
  55. package/dist/util/childEnv.js +43 -0
  56. package/dist/util/dotenv.d.ts +12 -0
  57. package/dist/util/dotenv.js +53 -0
  58. package/dist/util/misc.d.ts +15 -0
  59. package/dist/util/misc.js +121 -0
  60. package/dist/version.d.ts +2 -0
  61. package/dist/version.js +2 -0
  62. package/dist/weigh/anthropicExact.d.ts +11 -0
  63. package/dist/weigh/anthropicExact.js +46 -0
  64. package/dist/weigh/diff.d.ts +14 -0
  65. package/dist/weigh/diff.js +19 -0
  66. package/dist/weigh/serializers.d.ts +21 -0
  67. package/dist/weigh/serializers.js +44 -0
  68. package/dist/weigh/tokens.d.ts +12 -0
  69. package/dist/weigh/tokens.js +23 -0
  70. package/dist/weigh/weigh.d.ts +6 -0
  71. package/dist/weigh/weigh.js +104 -0
  72. package/docs/INTEGRATIONS.md +119 -0
  73. package/docs/METHODOLOGY.md +83 -0
  74. package/docs/RULES.md +76 -0
  75. package/package.json +77 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to efaimo are documented here. Format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0]
10
+
11
+ First release.
12
+
13
+ ### Added
14
+
15
+ - `efaimo weigh`: context-window cost of MCP tool definitions (stdio, remote, or a
16
+ whole client config) and of Agent Skills, in three serializations, with an
17
+ optional `--anthropic` exact Claude count. Per-tool numbers plus an explicit
18
+ block-framing line reconcile exactly with the total. In a multi-server run a
19
+ broken or auth-gated server is skipped with a reason, not fatal.
20
+ `--out`/`--diff`/`--max-tokens`/`--allow-increase` for CI budget gates,
21
+ `--badge` for a shields endpoint.
22
+ - `efaimo check --mcp`: a quality grade (E121-E130: descriptions, schemas,
23
+ annotations, cost) plus a separate, ungraded 2026-07-28 migration diff
24
+ (E101-E118: what the stateless spec breaks and how to fix it, each item naming
25
+ its SEP). Speaks both the legacy handshake and bare stateless requests, so
26
+ 2026-07-28 servers audit fine. Optional `--repo` source scan and
27
+ `--conformance` passthrough to the official suite.
28
+ - `efaimo check --skill`: Agent Skills linter against the agentskills.io spec
29
+ (S101-S106): frontmatter and trigger quality, trigger collisions, context budget,
30
+ reference integrity, injection heuristics. Per-skill grading over a directory, and
31
+ a reproducible Skills Quality Index (`scripts/skills-corpus.mjs` pins the corpus
32
+ to exact commits; `scripts/skills-index.mjs` grades it).
33
+ - `efaimo test` (experimental): an A/B outcome harness that measures whether a skill
34
+ actually improves task completion. Dry-run by default (validates the scenario, no
35
+ API calls); `--live` runs against the Anthropic or OpenAI API, and it fails clearly
36
+ on an unsupported model provider.
37
+ - `efaimo mcp`: a small, read-only MCP server exposing `efaimo_check_skill` and
38
+ `efaimo_weigh_skill`, so an agent can lint or weigh a skill mid-session. Reads
39
+ files only; `test` is not exposed; tools are annotated read-only.
40
+ - `.env` loading for the commands that need a key (`test --live`,
41
+ `weigh --anthropic`); a real shell variable always wins. See `.env.example`.
42
+ - Reporters: pretty, JSON, Markdown, SVG badge. GitHub Action (`action.yml`).
43
+ Documented rule set (`docs/RULES.md`), token methodology (`docs/METHODOLOGY.md`),
44
+ and integration guide (`docs/INTEGRATIONS.md`).
45
+
46
+ [Unreleased]: https://github.com/efaimo-ai/efaimo/compare/v0.1.0...HEAD
47
+ [0.1.0]: https://github.com/efaimo-ai/efaimo/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ efaimo
2
+ Copyright 2026 efaimo ai
3
+
4
+ This product includes software developed at efaimo ai (https://efaimo.ai).
5
+
6
+ Licensed under the Apache License, Version 2.0. See the LICENSE file.
package/README.md ADDED
@@ -0,0 +1,281 @@
1
+ <p align="center">
2
+ <img src="assets/banner.png" alt="efaimo. The audit CLI for Agent Skills and MCP servers." width="820">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/efaimo-ai/efaimo/actions/workflows/ci.yml"><img src="https://github.com/efaimo-ai/efaimo/actions/workflows/ci.yml/badge.svg" alt="ci"></a>
7
+ <a href="https://www.npmjs.com/package/efaimo"><img src="https://img.shields.io/npm/v/efaimo.svg?color=57E7D6&label=npm" alt="npm"></a>
8
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="license"></a>
9
+ <img src="https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg" alt="node >= 22">
10
+ </p>
11
+
12
+ <p align="center">
13
+ <b>efaimo</b> audits everything your agent loads: <b>MCP servers</b> and <b>Agent Skills</b>.<br>
14
+ One CLI lints them, weighs their context cost, diffs servers against the 2026-07-28 spec,<br>
15
+ and A/B-tests whether a skill actually helps.
16
+ </p>
17
+
18
+ Everything you plug into an agent spends two budgets before any work happens:
19
+ context-window tokens, and the trigger quality that decides whether the right tool
20
+ fires at all. Good tools exist for single slices of that problem; efaimo's job is
21
+ the whole audit in one command, for both halves of what an agent loads. Lint a
22
+ skill, weigh a server's tool definitions, get a migration diff for the 2026-07-28
23
+ stateless MCP spec, and measure whether a skill actually improves task completion
24
+ ([SkillsBench](https://www.skillsbench.ai) found 16 of 84 curated skills making
25
+ agents worse; linting alone cannot catch that).
26
+
27
+ ## Agent Skills
28
+
29
+ ```bash
30
+ npx efaimo check --skill ./skills/
31
+ ```
32
+
33
+ Point it at one skill or a whole folder. It validates each skill against the
34
+ [agentskills.io](https://agentskills.io) spec and grades it:
35
+
36
+ ```text
37
+ check skill claude-api
38
+ grade C (71) 1 error 2 warnings 4 info
39
+
40
+ x S101 description is 1068 chars (spec max 1024)
41
+ ! S104 instructions are ~18.4k tokens (spec recommends staying under 5k)
42
+ fix: move detail into references/ files loaded on demand
43
+ ! S104 SKILL.md is 570 lines (spec recommends under 500)
44
+ i S104 metadata level is ~294 tokens; the spec targets ~100 and this loads at
45
+ startup for every installed skill
46
+ ```
47
+
48
+ *(That is Anthropic's own `claude-api` skill.)* efaimo checks frontmatter and
49
+ trigger quality, collisions across an installed set, the context budget (metadata
50
+ loaded every session, body loaded on trigger), reference integrity, and injection
51
+ hygiene. Run it on a folder and every skill gets its own grade, not one aggregate.
52
+
53
+ **We graded 36 public Agent Skills**: every skill in `anthropics/skills`,
54
+ `anthropics/claude-cookbooks`, and `obra/superpowers`, at pinned commits. 97%
55
+ score an A, but even this curated set has real issues: Anthropic's own
56
+ `claude-api` scores a C with an over-limit description and ~18k-token
57
+ instructions, and the median skill's instructions run ~1,700 tokens loaded on
58
+ every trigger. Full report, the corpus manifest, and the two commands that
59
+ reproduce it: [the Skills Quality Index](./research/skills-index/REPORT.md).
60
+
61
+ ### Does the skill actually help? (experimental)
62
+
63
+ Linting tells you a skill is well-formed. It does not tell you the skill makes the
64
+ agent *better*, and research shows some skills make it worse. `efaimo test` measures
65
+ that directly: it runs a task with and without the skill, N trials each, and an LLM
66
+ judge scores every attempt.
67
+
68
+ ```bash
69
+ npx efaimo test scenario.yaml # dry run: validate + show the plan, no API calls
70
+ npx efaimo test scenario.yaml --live # run it for real (Claude or GPT)
71
+ npx efaimo test scenario.yaml --live --model gpt-4o-mini
72
+ ```
73
+
74
+ Works with Claude (`ANTHROPIC_API_KEY`) or GPT (`OPENAI_API_KEY`) models; the
75
+ provider is picked from the model name. Put the key in your shell or a local
76
+ `.env` file (copy `.env.example`); a real shell variable always wins.
77
+
78
+ Two real runs (claude-sonnet-5, 8 trials each) show why this matters: a generic
79
+ csv-cleanup skill that a capable model does not need, and a skill that encodes a
80
+ convention the model cannot guess.
81
+
82
+ <p align="center">
83
+ <img src="assets/test-ab.png" alt="efaimo test A/B results: csv-cleanup measures +0 points (no measurable effect) while contoso-crm-import measures +100 points (helps); both skills lint clean at grade A" width="880">
84
+ </p>
85
+
86
+ <details>
87
+ <summary>The two runs as copyable text</summary>
88
+
89
+ ```text
90
+ test csv-cleanup helps on a messy CSV
91
+ with skill 8/8 pass (100%)
92
+ without skill 8/8 pass (100%)
93
+ delta +0 points no measurable effect
94
+ ```
95
+
96
+ ```text
97
+ test contoso-crm-import helps on an unknowable format
98
+ with skill 8/8 pass (100%)
99
+ without skill 0/8 pass (0%)
100
+ delta +100 points helps
101
+ ```
102
+
103
+ </details>
104
+
105
+ The first is pure context overhead, the second earns its tokens, and only the
106
+ trial data tells them apart. Experimental and probabilistic: raise the trial
107
+ count for confidence, and treat small deltas as noise. It is opt-in because a
108
+ live run spends tokens on your key. See
109
+ [examples/scenario.example.yaml](./examples/scenario.example.yaml) and
110
+ [examples/scenario.crm.yaml](./examples/scenario.crm.yaml).
111
+
112
+ ## MCP servers
113
+
114
+ ```bash
115
+ npx efaimo weigh "npx -y my-mcp-server" # what does it cost my context window?
116
+ npx efaimo check --mcp "npx -y my-server" # quality grade + 2026-07-28 migration diff
117
+ ```
118
+
119
+ `weigh` reports the token cost of tool definitions in three real serializations,
120
+ per tool, with an optional `--anthropic` exact Claude count.
121
+
122
+ <p align="center">
123
+ <img src="assets/demo.png" alt="efaimo weigh example output" width="720">
124
+ </p>
125
+
126
+ `check --mcp` connects live (it speaks both the legacy handshake and the new
127
+ stateless protocol, so a 2026-07-28 server audits fine) and reports two things,
128
+ separately. First, a **quality grade** for what models actually experience:
129
+ descriptions, schemas, annotations, tool count, token cost. Second, an ungraded
130
+ **migration diff** for the 2026-07-28 stateless spec (which removes
131
+ `initialize`, sessions, Sampling, Roots, and Logging, and requires
132
+ `server/discover`, `resultType`, and cache fields): exactly what will break and
133
+ how to fix it, each rule naming the SEP it came from. Readiness never drags the
134
+ grade; not having migrated to a spec that is not final until 2026-07-28 is a
135
+ to-do list, not a defect. Full list: [docs/RULES.md](./docs/RULES.md).
136
+
137
+ <p align="center">
138
+ <img src="assets/check.png" alt="efaimo check example output: quality grade A (95) plus a four-item 2026-07-28 migration diff for the reference server" width="800">
139
+ </p>
140
+
141
+ *(That is the official reference server: solid quality, four things to migrate
142
+ before the 28th.)*
143
+
144
+ <details>
145
+ <summary>The same output as copyable text</summary>
146
+
147
+ ```text
148
+ check mcp npx -y @modelcontextprotocol/server-everything
149
+ grade A (95) quality: 0 errors 1 warning 0 info
150
+
151
+ ! E122 tool "echo": description misses 3/4 quality axes (length 40..600;
152
+ says when to use it; mentions the result)
153
+
154
+ 2026-07-28 readiness 4 items to migrate (a migration diff, not graded: the
155
+ spec finalizes 2026-07-28)
156
+ ! E104 server declares the logging capability; MCP Logging is deprecated in
157
+ 2026-07-28 (SEP-2577) and logging/setLevel is removed
158
+ ! E106 server/discover is not implemented (-32601 Method not found)
159
+ ! E118 tools/list result omits ttlMs and/or cacheScope, which 2026-07-28
160
+ requires on list and resource-read results (SEP-2549, CacheableResult)
161
+ i E107 results do not carry the resultType field required in 2026-07-28
162
+ ("complete" | "input_required")
163
+ ```
164
+
165
+ </details>
166
+
167
+ ## From an agent
168
+
169
+ `efaimo mcp` runs efaimo as a small, read-only MCP server, so an agent can lint or
170
+ weigh a skill mid-session, before it commits it to context:
171
+
172
+ ```bash
173
+ npx efaimo mcp # stdio server exposing efaimo_check_skill and efaimo_weigh_skill
174
+ ```
175
+
176
+ It reads files only (it spawns no process and opens no socket), and the
177
+ token-spending `test` is not exposed. Client config and recipes are in
178
+ [docs/INTEGRATIONS.md](./docs/INTEGRATIONS.md).
179
+
180
+ ## How it works
181
+
182
+ efaimo sits between your agent and everything it loads, measures the cost the way
183
+ your host actually serializes it, and grades the quality, before any of it reaches
184
+ your context window.
185
+
186
+ <p align="center">
187
+ <img src="assets/architecture.png" alt="efaimo weighs, checks, and tests what your agent loads" width="880">
188
+ </p>
189
+
190
+ ## How it compares
191
+
192
+ Focused tools already own single slices of this space, and some are very good.
193
+ efaimo is the one tool that covers the whole audit surface. As of mid-2026:
194
+
195
+ | | efaimo | [skill-validator](https://github.com/agent-ecosystem/skill-validator) | [upskill](https://github.com/huggingface/upskill) | [mcp-spec-check](https://github.com/Roee-Tsur/mcp-spec-check) | [conformance](https://github.com/modelcontextprotocol/conformance) (official) |
196
+ |---|---|---|---|---|---|
197
+ | Agent Skills linting | yes | yes | no | no | no |
198
+ | Skill token cost | yes (3-level split) | yes | no | no | no |
199
+ | Skill outcome testing | with/without A/B trials (experimental) | static LLM scoring | yes (generate + eval, code agents) | no | no |
200
+ | MCP tool-definition cost | yes (3 serializations, `--anthropic` exact) | no | no | no | no |
201
+ | MCP quality rules | yes | no | no | no | no |
202
+ | 2026-07-28 readiness | migration diff: what breaks and how to fix | no | no | yes/no verdict | official test suite |
203
+ | CI budget gate + badge | yes | no | no | no | no |
204
+
205
+ efaimo runs the official conformance suite for you (`check --conformance` on
206
+ http targets) and complements security scanners such as Snyk agent-scan and the
207
+ skills installer (`npx skills`) rather than replacing them.
208
+
209
+ ## Install
210
+
211
+ Nothing to install. Use `npx`:
212
+
213
+ ```bash
214
+ npx efaimo check --skill ./skills/
215
+ ```
216
+
217
+ Or add it to a project with `npm i -D efaimo`, or the GitHub Action:
218
+
219
+ ```yaml
220
+ - uses: efaimo-ai/efaimo@v0
221
+ with:
222
+ command: check --skill ./skills --strict
223
+ ```
224
+
225
+ Gate a pull request on context-window growth, too:
226
+
227
+ ```bash
228
+ npx efaimo weigh "npx -y my-server" --out base.json # record a baseline
229
+ npx efaimo weigh "npx -y my-server" --diff base.json --allow-increase 10
230
+ ```
231
+
232
+ `--badge badge.svg` writes an SVG plus a shields.io endpoint JSON for your
233
+ README. These two are real efaimo output for the reference server:
234
+
235
+ <img src="assets/badge-weigh.svg" alt="context cost: 1120 tok (o200k)"> <img src="assets/badge-grade.svg" alt="efaimo: A (95)">
236
+
237
+ More recipes (pre-commit, GitLab, editor audit, programmatic use):
238
+ [docs/INTEGRATIONS.md](./docs/INTEGRATIONS.md).
239
+
240
+ ## Rules at a glance
241
+
242
+ | family | covers |
243
+ |---|---|
244
+ | **S101 to S106** | skills: frontmatter and trigger quality, trigger collisions, context budget, reference integrity, injection hygiene |
245
+ | **E101 to E118** | MCP 2026-07-28 readiness: deprecated primitives, statelessness, `server/discover`, `resultType`, cache fields, transport |
246
+ | **E121 to E130** | MCP quality: description quality, annotations, schema hygiene, tool-count and token-cost budgets |
247
+
248
+ Quality (E12x-E13x) and skill (S) findings set the letter grade; readiness
249
+ findings (E101-E118) are reported as an ungraded migration diff until the spec
250
+ ratifies. Every finding carries a stable id you can suppress or link. See
251
+ [docs/RULES.md](./docs/RULES.md).
252
+
253
+ ## Roadmap
254
+
255
+ - Harden `efaimo test`: a separately chosen judge model, confidence intervals on
256
+ the delta, multi-turn tool-use trials, and judge calibration, so the
257
+ experimental harness earns unqualified trust.
258
+ - Track the 2026-07-28 spec to ratification, then start grading readiness (today
259
+ it is an ungraded migration diff on purpose).
260
+ - A public, continuously updated Agent Skills Quality Index over a broad corpus.
261
+
262
+ ## Stability
263
+
264
+ efaimo is 0.x. The commands are stable, but the rule set, grades, and exact output
265
+ may change between minor versions until 1.0; pin a version in CI if you need
266
+ reproducible thresholds. Every finding keeps a stable id.
267
+
268
+ ## Honest scope
269
+
270
+ efaimo is a linter and cost profiler, not a security scanner. Its injection checks
271
+ are info-level heuristics that an attacker evades trivially; a clean report is not a
272
+ security pass. For supply-chain safety use a dedicated scanner such as Snyk
273
+ agent-scan. Token figures are estimates unless you opt into `--anthropic`; the
274
+ method and its known bias are in [docs/METHODOLOGY.md](./docs/METHODOLOGY.md).
275
+
276
+ ## About
277
+
278
+ Built by [efaimo ai](https://efaimo.ai), open tooling for the space between hosts
279
+ and tools. `efaimo` is the flagship CLI; capabilities grow as subcommands under one
280
+ name. Apache-2.0. See [CONTRIBUTING.md](./CONTRIBUTING.md) and
281
+ [docs/RULES.md](./docs/RULES.md) to add a rule.
package/SKILL.md ADDED
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: efaimo
3
+ description: Audit MCP servers and Agent Skills for quality and context-window cost. Use when the user wants to check an MCP server's token cost, lint a skill, verify 2026-07-28 MCP spec readiness, or add an efaimo badge or CI gate.
4
+ license: Apache-2.0
5
+ metadata:
6
+ version: "0.1.0"
7
+ homepage: "https://efaimo.ai"
8
+ ---
9
+
10
+ # efaimo
11
+
12
+ efaimo audits what an agent loads: the quality and context-window cost of MCP
13
+ servers and Agent Skills. Reach for it when someone asks "how many tokens does
14
+ this MCP server cost", "is my server ready for the 2026-07-28 MCP spec", "is this
15
+ skill well-formed", or "add a CI gate / badge for context cost".
16
+
17
+ ## Commands
18
+
19
+ Run via `npx efaimo` (no install needed).
20
+
21
+ - **Weigh context cost of an MCP server**
22
+ `npx efaimo weigh "npx -y <server-package>"` for a stdio server, or
23
+ `npx efaimo weigh https://host/mcp` for a remote one. Add `--json` for machine
24
+ output, `--badge badge.svg` for a shields badge, `--anthropic` for Claude-exact
25
+ token counts.
26
+ - **Weigh a skill or skill set**
27
+ `npx efaimo weigh ./path/to/skill` reports the metadata / body / referenced-file
28
+ token split.
29
+ - **Weigh everything a client loads**
30
+ `npx efaimo weigh --client claude-code` (also `claude-desktop`, `cursor`,
31
+ `vscode`) sums every configured server.
32
+ - **Audit an MCP server**
33
+ `npx efaimo check --mcp "npx -y <server>"` prints a quality grade plus a
34
+ separate 2026-07-28 migration diff (what breaks under the stateless spec and
35
+ how to fix it). Add `--repo ./src` to also scan source for deprecated
36
+ primitives, `--strict` to fail on warnings.
37
+ - **Lint a skill**
38
+ `npx efaimo check --skill ./skills/` validates frontmatter, trigger quality,
39
+ context budget, file references, and injection patterns.
40
+ - **Gate a pull request on context cost**
41
+ Save a baseline with `npx efaimo weigh "<server>" --out base.json`, then in CI
42
+ run `npx efaimo weigh "<server>" --diff base.json --allow-increase 10` to fail
43
+ when the tool-definition budget grows more than 10 percent.
44
+
45
+ ## Reading the output
46
+
47
+ Findings carry a stable rule id (E1xx MCP readiness, E12x-E13x MCP quality, S1xx
48
+ skills) and a severity. The letter grade covers quality and skill findings only;
49
+ 2026-07-28 readiness items appear separately as an ungraded migration diff. Token
50
+ numbers are o200k estimates unless `--anthropic` is used; see the methodology doc
51
+ for the full method.
52
+
53
+ ## Notes
54
+
55
+ efaimo is a linter and cost profiler, not a security scanner: its injection checks
56
+ are surface heuristics. For supply-chain security use a dedicated scanner. Full
57
+ rule reference: https://github.com/efaimo-ai/efaimo/blob/main/docs/RULES.md
@@ -0,0 +1,31 @@
1
+ import type { CheckReport, Finding, ProbeResults, ServerIntrospection, ServerWeighResult, SkillSetWeighResult } from "../core/types.js";
2
+ import type { ResolvedTarget } from "../targets/resolve.js";
3
+ export interface CheckMcpResult {
4
+ report: CheckReport;
5
+ intro: ServerIntrospection;
6
+ weigh: ServerWeighResult;
7
+ probes?: ProbeResults;
8
+ }
9
+ export declare function checkMcpTarget(target: Extract<ResolvedTarget, {
10
+ kind: "stdio" | "http";
11
+ }>, opts?: {
12
+ timeoutMs?: number;
13
+ probe?: boolean;
14
+ repoPath?: string;
15
+ anthropicApiKey?: string;
16
+ }): Promise<CheckMcpResult>;
17
+ export declare function checkMcpRepoOnly(repoPath: string, label: string): CheckReport;
18
+ export interface SkillReport {
19
+ name: string;
20
+ dir: string;
21
+ report: CheckReport;
22
+ }
23
+ export interface CheckSkillResult {
24
+ label: string;
25
+ root: string;
26
+ perSkill: SkillReport[];
27
+ /** Set-level findings (e.g. trigger collisions across skills). */
28
+ setFindings: Finding[];
29
+ weigh: SkillSetWeighResult;
30
+ }
31
+ export declare function checkSkillSet(pathInput: string, label: string): Promise<CheckSkillResult>;