crewscore 0.2.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 (36) hide show
  1. crewscore-0.2.0/.github/workflows/crewscore-selftest.yml +46 -0
  2. crewscore-0.2.0/.github/workflows/example-ci.yml +46 -0
  3. crewscore-0.2.0/.gitignore +14 -0
  4. crewscore-0.2.0/AGENTS.md +72 -0
  5. crewscore-0.2.0/CNAME +1 -0
  6. crewscore-0.2.0/LICENSE +21 -0
  7. crewscore-0.2.0/PKG-INFO +311 -0
  8. crewscore-0.2.0/README.md +284 -0
  9. crewscore-0.2.0/action.yml +62 -0
  10. crewscore-0.2.0/crewscore/__init__.py +3 -0
  11. crewscore-0.2.0/crewscore/cli.py +403 -0
  12. crewscore-0.2.0/crewscore/report.py +171 -0
  13. crewscore-0.2.0/crewscore/scorers/__init__.py +1 -0
  14. crewscore-0.2.0/crewscore/scorers/fix_patterns.py +184 -0
  15. crewscore-0.2.0/crewscore/scorers/structural_analysis.py +359 -0
  16. crewscore-0.2.0/crewscore/scoring.py +75 -0
  17. crewscore-0.2.0/crewscore/vendor_scorecard.py +412 -0
  18. crewscore-0.2.0/docs/launch/README.md +57 -0
  19. crewscore-0.2.0/docs/launch/devto.md +107 -0
  20. crewscore-0.2.0/docs/launch/linkedin.md +49 -0
  21. crewscore-0.2.0/docs/launch/reddit.md +105 -0
  22. crewscore-0.2.0/docs/launch/show-hn.md +64 -0
  23. crewscore-0.2.0/docs/launch/x-post.md +64 -0
  24. crewscore-0.2.0/docs/pmf-research-2026-07-28.md +327 -0
  25. crewscore-0.2.0/docs/publish-checklist.md +132 -0
  26. crewscore-0.2.0/docs/superpowers/plans/2026-07-28-crewscore-viral-launch.md +457 -0
  27. crewscore-0.2.0/docs/viral-product-spec-2026-07-28.md +354 -0
  28. crewscore-0.2.0/examples/sample-prompt.md +1 -0
  29. crewscore-0.2.0/index.html +274 -0
  30. crewscore-0.2.0/pyproject.toml +62 -0
  31. crewscore-0.2.0/tests/test_action_manifest.py +10 -0
  32. crewscore-0.2.0/tests/test_cli.py +98 -0
  33. crewscore-0.2.0/tests/test_explain.py +108 -0
  34. crewscore-0.2.0/tests/test_report.py +114 -0
  35. crewscore-0.2.0/tests/test_structural_analysis.py +86 -0
  36. crewscore-0.2.0/tests/test_vendor.py +152 -0
@@ -0,0 +1,46 @@
1
+ # Self-test for the composite CrewScore action in this repo.
2
+ # Installs from github.action_path so it works before PyPI publish.
3
+ name: CrewScore Self-Test
4
+
5
+ on:
6
+ push:
7
+ pull_request:
8
+
9
+ jobs:
10
+ selftest:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Score sample prompt (smoke, threshold 0)
17
+ id: score
18
+ uses: ./
19
+ with:
20
+ prompt-file: examples/sample-prompt.md
21
+ threshold: "0"
22
+
23
+ - name: Assert score and tier outputs parse
24
+ run: |
25
+ echo "score=${{ steps.score.outputs.score }}"
26
+ echo "tier=${{ steps.score.outputs.tier }}"
27
+ python -c "
28
+ import sys
29
+ score = int(sys.argv[1])
30
+ tier = sys.argv[2]
31
+ assert 0 <= score <= 100, score
32
+ assert tier, 'tier output empty'
33
+ print(f'OK score={score} tier={tier!r}')
34
+ " "${{ steps.score.outputs.score }}" "${{ steps.score.outputs.tier }}"
35
+
36
+ - name: Threshold gate fails when score is below threshold
37
+ run: |
38
+ set +e
39
+ crewscore test --prompt-file examples/sample-prompt.md --json --threshold 50
40
+ EXIT=$?
41
+ set -e
42
+ if [ "$EXIT" -ne 2 ]; then
43
+ echo "Expected exit code 2 for bare sample prompt under threshold 50, got $EXIT"
44
+ exit 1
45
+ fi
46
+ echo "Threshold failure behaved as expected (exit 2)"
@@ -0,0 +1,46 @@
1
+ # Documented copy-paste example for consumers.
2
+ #
3
+ # In your own repo, prefer the published tag:
4
+ # uses: shmindmaster/crewscore@v1
5
+ #
6
+ # When developing this monorepo (or a fork), local path works:
7
+ # uses: ./
8
+ #
9
+ # Point prompt-file at your agent system prompt. The sample path below is only
10
+ # for illustration; examples/sample-prompt.md intentionally scores low.
11
+ #
12
+ # workflow_dispatch only so this example does not fail default CI on the bare
13
+ # sample prompt. Use crewscore-selftest.yml for green self-tests.
14
+ name: CrewScore CI Example
15
+
16
+ on:
17
+ workflow_dispatch:
18
+
19
+ jobs:
20
+ score:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+
26
+ # Published action (recommended for consumer repos):
27
+ # - name: CrewScore
28
+ # uses: shmindmaster/crewscore@v1
29
+ # with:
30
+ # prompt-file: agents/system-prompt.md
31
+ # threshold: "50"
32
+ # # explain: "true"
33
+
34
+ # Local composite action (this repo / monorepo self-check):
35
+ - name: CrewScore
36
+ id: crewscore
37
+ uses: ./
38
+ with:
39
+ prompt-file: examples/sample-prompt.md
40
+ threshold: "50"
41
+
42
+ - name: Use score outputs
43
+ if: always()
44
+ run: |
45
+ echo "score=${{ steps.crewscore.outputs.score }}"
46
+ echo "tier=${{ steps.crewscore.outputs.tier }}"
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .env
8
+ *.sqlite3
9
+ agent-guard-report-*.html
10
+ .DS_Store
11
+
12
+ .superpowers/
13
+ .worktrees/
14
+
@@ -0,0 +1,72 @@
1
+ # CrewScore — agent instructions
2
+
3
+ ## What this is
4
+
5
+ Offline CLI that **structurally** scores AI agent system prompts for production-readiness signals (injection defense, hallucination policy, citations, cost limits, human gates, safe-stop, audit, compliance), applies fix patterns, and runs a non-technical AI vendor checklist.
6
+
7
+ Public brand: **CrewScore** · Domain: **https://crewscore.ai** · PyPI: **`crewscore`** · Repo: **shmindmaster/crewscore**
8
+
9
+ It does **not** (yet) run live adversarial LLM attacks or parse LangGraph/CrewAI runtimes.
10
+
11
+ ## Stack
12
+
13
+ - Python 3.11+
14
+ - click + rich
15
+ - hatchling packaging
16
+ - pytest
17
+
18
+ ## Commands
19
+
20
+ ```bash
21
+ # install (editable)
22
+ pip install -e ".[dev]"
23
+
24
+ # score a prompt
25
+ crewscore test --prompt "You are a helpful assistant..."
26
+ crewscore test --prompt-file ./system-prompt.md
27
+ crewscore test --prompt-file ./system-prompt.md --json
28
+ crewscore test --prompt-file ./system-prompt.md --json --threshold 50
29
+
30
+ # apply guardrail patterns
31
+ crewscore fix --prompt-file ./system-prompt.md
32
+ crewscore fix --prompt-file ./system-prompt.md --apply
33
+ crewscore fix --prompt-file ./system-prompt.md --output ./guarded.md --json
34
+
35
+ # vendor checklist
36
+ crewscore assess-vendor --name "Acme AI" --answers "y,y,n,dk,y,y,n,y,n,y" --json
37
+
38
+ # tests
39
+ pytest
40
+ ```
41
+
42
+ Legacy CLI entry point `agent-guard` still maps to the same `crewscore.cli:main` after install.
43
+
44
+ ## Layout
45
+
46
+ ```
47
+ crewscore/
48
+ cli.py # click entry (test, fix)
49
+ scoring.py # shared result model / tiers
50
+ vendor_scorecard.py # assess-vendor command
51
+ scorers/
52
+ structural_analysis.py
53
+ fix_patterns.py
54
+ tests/
55
+ index.html # static browser demo (client-side structural scan)
56
+ ```
57
+
58
+ ## Product constraints
59
+
60
+ - Prefer honest capability claims over roadmap theater.
61
+ - Structural scores are pattern matches on prompt text, not proof of runtime behavior.
62
+ - Keep the package dependency-light (no LLM SDKs required for the core path).
63
+ - Fame follows usefulness: explainable findings, fix, CI gate before launch theater.
64
+ - Breaking CLI flags are acceptable if all docs and tests update in the same change.
65
+ - Never document `pip install agent-guard` as *this* product (that PyPI name is taken by another package).
66
+
67
+ ## Do not
68
+
69
+ - Reintroduce fake `--langgraph` / `--crewai` loaders or adversarial mode stubs without real implementations.
70
+ - Link to non-existent report hosts or wrong GitHub/PyPI names.
71
+ - Add empty `examples/` / `evaluator/` / `patterns/` directories without content.
72
+ - Overclaim “production safety certification” or “7 regulated systems” beyond structural scanning.
crewscore-0.2.0/CNAME ADDED
@@ -0,0 +1 @@
1
+ crewscore.ai
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sarosh Hussain / Pendoah
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,311 @@
1
+ Metadata-Version: 2.4
2
+ Name: crewscore
3
+ Version: 0.2.0
4
+ Summary: CrewScore — offline structural production-readiness scorecard for AI agent system prompts.
5
+ Project-URL: Homepage, https://crewscore.ai
6
+ Project-URL: Repository, https://github.com/shmindmaster/crewscore
7
+ Project-URL: Issues, https://github.com/shmindmaster/crewscore/issues
8
+ Project-URL: Documentation, https://github.com/shmindmaster/crewscore#readme
9
+ Author-email: Sarosh Hussain <sarosh@pendoah.ai>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai-agents,crewscore,evaluation,governance,guardrails,llm,production,safety,scorecard
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: click>=8.0
23
+ Requires-Dist: rich>=13.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=8.0; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ <div align="center">
29
+
30
+ # CrewScore
31
+
32
+ ### Structural production-readiness scorecard for AI agent system prompts
33
+
34
+ **Site:** [crewscore.ai](https://crewscore.ai) · **Install:** `pip install crewscore`
35
+
36
+ ```
37
+ $ pip install crewscore
38
+ $ crewscore test --prompt "You are a helpful assistant that..."
39
+
40
+ CREWSCORE — Structural Production Readiness Report
41
+ ====================================================
42
+
43
+ Prompt Injection Resistance [----------] 0/100 MISSING
44
+ Hallucination Guardrails [----------] 0/100 MISSING
45
+ Source Citation Requirements [----------] 0/100 MISSING
46
+ Cost Runaway Protection [----------] 0/100 MISSING
47
+ Human-in-the-Loop Gates [----------] 0/100 MISSING
48
+ Safe-Stop Behavior [----------] 0/100 MISSING
49
+ Audit Trail & Provenance [----------] 0/100 MISSING
50
+ Compliance Readiness [----------] 0/100 MISSING
51
+
52
+ OVERALL SCORE: 0/100 NOT PRODUCTION READY
53
+ ```
54
+
55
+ Score the **text** of your agent instructions. Fix gaps. Gate CI when scores drop.
56
+
57
+ [Install](#install) · [Usage](#usage) · [Share](#share-your-score) · [How scoring works](#how-scoring-works) · [CI](#ci-integration) · [Limits](#what-this-is-and-is-not)
58
+
59
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
60
+ [![Python](https://img.shields.io/badge/Python-3.11+-green.svg)](https://python.org)
61
+ [![PyPI](https://img.shields.io/badge/PyPI-crewscore-blue.svg)](https://pypi.org/project/crewscore/)
62
+
63
+ </div>
64
+
65
+ ---
66
+
67
+ ## The problem
68
+
69
+ You shipped an agent that works in a demo. Before production you still need to ask:
70
+
71
+ - Does the prompt resist obvious injection / override language?
72
+ - Does it forbid fabricating citations and force “I don’t know”?
73
+ - Are writes, sends, and publishes gated on human approval?
74
+ - Is there any cost, audit, or compliance language at all?
75
+
76
+ Most teams never inspect those instructions systematically. **CrewScore** does a fast structural scan and can append proven guardrail patterns.
77
+
78
+ ---
79
+
80
+ ## What this is (and is not)
81
+
82
+ | Is | Is not |
83
+ |----|--------|
84
+ | Offline structural scan of system-prompt text | Live adversarial LLM red-teaming |
85
+ | Fix mode that appends guardrail sections | Proof that the runtime will obey the text |
86
+ | JSON output + exit threshold for CI | LangGraph / CrewAI graph execution analysis |
87
+ | Vendor checklist (`assess-vendor`) for procurement diligence | Independent security certification |
88
+
89
+ Scores reflect **prompt-text signals**. They are a useful smoke test, not a guarantee of runtime safety.
90
+
91
+ > **Name note:** PyPI package `agent-guard` is an unrelated third-party CrewAI monitoring library. This project is **CrewScore** (`pip install crewscore`). The CLI also accepts the legacy alias `agent-guard` after install.
92
+
93
+ ---
94
+
95
+ ## Install
96
+
97
+ ```bash
98
+ pip install crewscore
99
+
100
+ # from source (development)
101
+ pip install -e ".[dev]"
102
+ ```
103
+
104
+ No API key for structural mode.
105
+
106
+ ---
107
+
108
+ ## Usage
109
+
110
+ ### Score a system prompt
111
+
112
+ ```bash
113
+ crewscore test --prompt "You are a customer service agent for..."
114
+ crewscore test --prompt-file ./my-agent/system-prompt.md
115
+ crewscore test --prompt-file ./my-agent/system-prompt.md --json
116
+ crewscore test --prompt-file ./my-agent/system-prompt.md --json --threshold 50
117
+ ```
118
+
119
+ `--threshold N` exits with code `2` when overall score is below `N` (CI gate).
120
+
121
+ ### Share your score
122
+
123
+ Export a self-contained HTML report and an SVG badge after scoring:
124
+
125
+ ```bash
126
+ crewscore test --prompt-file ./system-prompt.md --report report.html --badge crewscore.svg
127
+ ```
128
+
129
+ Embed the badge in a README or PR description (path relative to your repo):
130
+
131
+ ```markdown
132
+ ![CrewScore](./crewscore.svg)
133
+ ```
134
+
135
+ Or point CI at a committed badge path after generating it in a workflow step:
136
+
137
+ ```markdown
138
+ ![CrewScore](./badges/crewscore.svg)
139
+ ```
140
+
141
+ Human mode also prints a one-line share blurb with your overall score and [crewscore.ai](https://crewscore.ai). Reports are structural-scan artifacts only — not runtime proof of safety.
142
+
143
+ ### Apply guardrail patterns
144
+
145
+ ```bash
146
+ # print enhanced prompt
147
+ crewscore fix --prompt-file ./system-prompt.md
148
+
149
+ # write in place and show score delta
150
+ crewscore fix --prompt-file ./system-prompt.md --apply
151
+
152
+ # write to a new file
153
+ crewscore fix --prompt-file ./system-prompt.md --output ./system-prompt-guarded.md
154
+
155
+ # machine-readable summary
156
+ crewscore fix --prompt-file ./system-prompt.md --apply --json
157
+ ```
158
+
159
+ ### Score an AI vendor (checklist)
160
+
161
+ ```bash
162
+ crewscore assess-vendor --name "Acme AI" --answers "y,y,n,dk,y,y,n,y,n,y"
163
+ crewscore assess-vendor --name "Acme AI" --answers "y,y,n,dk,y,y,n,y,n,y" --json
164
+ ```
165
+
166
+ Answers are `y` / `n` / `dk` for each of 10 diligence questions.
167
+
168
+ ### Browser demo
169
+
170
+ Open `index.html` locally (or on GitHub Pages) for a zero-install structural scan and vendor checklist UI (client-side only; not the CLI implementation).
171
+
172
+ ---
173
+
174
+ ## How scoring works
175
+
176
+ Eight dimensions, equal weight, each 0–100:
177
+
178
+ | Dimension | What the scanner looks for |
179
+ |-----------|----------------------------|
180
+ | Prompt Injection Resistance | Reject-override / do-not-reveal-system / jailbreak language |
181
+ | Hallucination Guardrails | No fabrication, “I don’t know”, grounded-only claims |
182
+ | Source Citation | Claims must cite sources / evidence |
183
+ | Cost Runaway Protection | Token/budget/max-length limits |
184
+ | Human-in-the-Loop Gates | Approval before send/write/publish |
185
+ | Safe-Stop Behavior | Halt when evidence missing or uncertain |
186
+ | Audit Trail | Log decisions / immutable trail language |
187
+ | Compliance Readiness | HIPAA/SOC2/GDPR/EU AI Act style handling language |
188
+
189
+ ### Score tiers
190
+
191
+ | Score | Verdict |
192
+ |-------|---------|
193
+ | 90–100 | PRODUCTION READY (structurally) |
194
+ | 70–89 | SHIP WITH MONITORING |
195
+ | 50–69 | NEEDS WORK |
196
+ | 0–49 | NOT PRODUCTION READY |
197
+
198
+ ---
199
+
200
+ ## CI integration
201
+
202
+ ### Official GitHub Action (recommended)
203
+
204
+ One YAML step — no manual pip ritual:
205
+
206
+ ```yaml
207
+ # .github/workflows/crewscore.yml
208
+ name: CrewScore
209
+ on: [pull_request]
210
+ jobs:
211
+ score:
212
+ runs-on: ubuntu-latest
213
+ steps:
214
+ - uses: actions/checkout@v4
215
+ - name: CrewScore
216
+ id: crewscore
217
+ uses: shmindmaster/crewscore@v1
218
+ with:
219
+ prompt-file: ./agents/system-prompt.md
220
+ threshold: "50"
221
+ # explain: "true" # optional: matched vs missing signals
222
+ - name: Report
223
+ if: always()
224
+ run: |
225
+ echo "score=${{ steps.crewscore.outputs.score }}"
226
+ echo "tier=${{ steps.crewscore.outputs.tier }}"
227
+ ```
228
+
229
+ **Inputs**
230
+
231
+ | Input | Required | Default | Description |
232
+ |-------|----------|---------|-------------|
233
+ | `prompt-file` | yes | — | Path to the system prompt file |
234
+ | `threshold` | no | `50` | Fail the step (exit 2) when overall score is below this |
235
+ | `explain` | no | `false` | Pass `true` to include matched/missing signals |
236
+
237
+ **Outputs:** `score` (0–100), `tier` (label string).
238
+
239
+ The composite action installs CrewScore from the action path (`pip install "${{ github.action_path }}"`), so monorepo / pre-PyPI self-tests work with `uses: ./`.
240
+
241
+ `uses: shmindmaster/crewscore@v1` requires a floating major tag `v1` on the release commit (in addition to the immutable `vX.Y.Z` tag). Maintainers create or move `v1` after each compatible release — see [docs/publish-checklist.md](docs/publish-checklist.md).
242
+
243
+ See [`.github/workflows/example-ci.yml`](.github/workflows/example-ci.yml) for a documented consumer template and [`.github/workflows/crewscore-selftest.yml`](.github/workflows/crewscore-selftest.yml) for this repo’s smoke self-test.
244
+
245
+ ### CLI in CI
246
+
247
+ ```yaml
248
+ # .github/workflows/crewscore-cli.yml
249
+ name: CrewScore CLI
250
+ on: [pull_request]
251
+ jobs:
252
+ score:
253
+ runs-on: ubuntu-latest
254
+ steps:
255
+ - uses: actions/checkout@v4
256
+ - uses: actions/setup-python@v5
257
+ with:
258
+ python-version: "3.12"
259
+ - run: pip install crewscore
260
+ - run: crewscore test --prompt-file ./agents/system-prompt.md --json --threshold 50
261
+ ```
262
+
263
+ Or parse JSON yourself:
264
+
265
+ ```bash
266
+ SCORE=$(crewscore test --prompt-file ./agents/system-prompt.md --json | jq '.overall')
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Fix patterns
272
+
273
+ When dimensions score below threshold, `crewscore fix` appends production-style guardrail sections for:
274
+
275
+ - Injection defense
276
+ - Anti-hallucination
277
+ - Citation requirements
278
+ - Cost governance
279
+ - Human gates
280
+ - Safe-stop
281
+ - Audit trail
282
+ - Compliance / data protection
283
+
284
+ These are **prompt text templates**. Wire matching runtime controls (tool gates, logging, budgets) in your application.
285
+
286
+ ---
287
+
288
+ ## Development
289
+
290
+ ```bash
291
+ git clone https://github.com/shmindmaster/crewscore.git
292
+ cd crewscore
293
+ pip install -e ".[dev]"
294
+ pytest
295
+ crewscore test --prompt "You are a helpful assistant"
296
+ ```
297
+
298
+ See [AGENTS.md](AGENTS.md) for agent/contributor operating notes.
299
+
300
+ ---
301
+
302
+ ## Roadmap (not implemented yet)
303
+
304
+ - Framework adapters that extract prompts from LangGraph / CrewAI / AutoGen graphs
305
+ - Optional live adversarial testing (post-traction; not the default path)
306
+
307
+ ---
308
+
309
+ ## License
310
+
311
+ MIT.