@capitalthought/agentsfirst-mcp 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.
- package/AGENTS.md +71 -0
- package/LICENSE +21 -0
- package/README.md +137 -0
- package/dist/prep.d.ts +12 -0
- package/dist/prep.js +90 -0
- package/dist/principles.d.ts +28 -0
- package/dist/principles.js +133 -0
- package/dist/probe.d.ts +192 -0
- package/dist/probe.js +528 -0
- package/dist/score.d.ts +40 -0
- package/dist/score.js +614 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +153 -0
- package/package.json +49 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# agentsfirst-mcp — Agent Rules
|
|
2
|
+
|
|
3
|
+
These rules govern how AI agents (Claude, Cursor, Windsurf, custom agents) use the tools exposed by `@capitalthought/agentsfirst-mcp`. Read this file before calling any tool. If something here contradicts a user request, surface the conflict — don't silently ignore the rule.
|
|
4
|
+
|
|
5
|
+
This is the **Contract First** artifact. See <https://agentsfirst.dev/principles/contract-first/>.
|
|
6
|
+
|
|
7
|
+
## Permissions
|
|
8
|
+
|
|
9
|
+
- **Every tool in this server is read-only.** The server probes filesystems and HTTP surfaces; it never writes, never mutates, never sends.
|
|
10
|
+
- `agentsfirst_prep`, `score_codebase`, `score_website`, `get_principle`, `get_anti_pattern` — all safe to call without confirmation.
|
|
11
|
+
- The server never opens network connections except (a) the optional canonical-API ping during `agentsfirst_prep` and (b) explicit `score_website` probes against the URL the caller provided.
|
|
12
|
+
- The server never reads `.env`, secrets files, or anything outside the directory passed to `score_codebase`. Only run it against directories the user already trusts you to inspect.
|
|
13
|
+
|
|
14
|
+
## Required prep
|
|
15
|
+
|
|
16
|
+
**Call `agentsfirst_prep` at the start of every session before any other tool.** It verifies the rubric is loaded (8 principles + 7 anti-patterns), Node is >=20, and the canonical principles URL is reachable. If `ok=false`, stop and surface the failed checks. Do not run a score against a half-loaded rubric.
|
|
17
|
+
|
|
18
|
+
This is the **Prep Gates** principle. See <https://agentsfirst.dev/principles/prep-gates/>.
|
|
19
|
+
|
|
20
|
+
## Identifiers
|
|
21
|
+
|
|
22
|
+
The vocabulary in this server has stable canonical slugs. Never invent one.
|
|
23
|
+
|
|
24
|
+
**Principle slugs** — `interface-first`, `contract-first`, `prep-gates`, `typed-state`, `visible-outputs`, `multi-model-verification`, `perspective-dispatch`, `autonomous-recovery`.
|
|
25
|
+
|
|
26
|
+
**Anti-pattern slugs** — `lazy-wrapper`, `invisible-product`, `agents-without-rules`, `single-model-trust`, `slow-chatbot`, `ship-and-forget`, `god-server`.
|
|
27
|
+
|
|
28
|
+
If you need to confirm a slug, the canonical machine-readable list is at `https://agentsfirst.dev/api/principles.json`. Never hand-construct a slug that isn't in this list — `get_principle` and `get_anti_pattern` will return `error: not_found` and the result will not match the human-readable canon.
|
|
29
|
+
|
|
30
|
+
## Sequence
|
|
31
|
+
|
|
32
|
+
The typical flow:
|
|
33
|
+
|
|
34
|
+
1. **Prep** — `agentsfirst_prep`.
|
|
35
|
+
2. **Score** — `score_codebase` (for a local directory) or `score_website` (for a URL).
|
|
36
|
+
3. **Explain (optional)** — `get_principle` or `get_anti_pattern` for any slug surfaced in the score, to give the human or downstream agent the canonical context.
|
|
37
|
+
|
|
38
|
+
`score_*` is the only step that needs to happen for a meaningful answer. The explain step is for follow-up — don't call it preemptively against all 8 principles; only fetch the ones the score surfaced.
|
|
39
|
+
|
|
40
|
+
## Errors
|
|
41
|
+
|
|
42
|
+
All tool errors return the same structured shape:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{ "error": "<machine_code>", "suggestion": "<one-line fix>" }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Known error codes:
|
|
49
|
+
|
|
50
|
+
- `probe_failed` — the underlying probe raised. Check the `detail` field for the cause; fix the path or URL and retry.
|
|
51
|
+
- `not_found` — the slug you passed isn't in the canonical list. The `suggestion` will name the valid set; pick from that.
|
|
52
|
+
|
|
53
|
+
Never retry blindly on `error: not_found` — the slug is wrong, not transiently unavailable.
|
|
54
|
+
|
|
55
|
+
## Visible outputs
|
|
56
|
+
|
|
57
|
+
Scoring runs are read-only and produce no side effects. The MCP response is the artifact. If you want a human-visible record, the consuming agent must ship one — log to Slack, email a summary, post a Linear issue. This server does not emit visible outputs of its own; it returns structured data.
|
|
58
|
+
|
|
59
|
+
When you produce a human-facing summary from a `score_*` result, lead with the score and level, not the throat-clearing. Match the report shape from the SKILL.md companion: numeric score, what's working, what's missing, anti-patterns flagged, top moves to climb a level.
|
|
60
|
+
|
|
61
|
+
## Anti-patterns to avoid when consuming this server
|
|
62
|
+
|
|
63
|
+
- **God Server** — don't expose all 5 of these tools as separate "skills" in your downstream UI. Group them: one "score" action that wraps `score_codebase`/`score_website`, one "explain" action that wraps `get_principle`/`get_anti_pattern`. Five tools is the cap, not the goal.
|
|
64
|
+
- **Single-Model Trust** — for high-stakes uses (acquisition due diligence, portfolio scoring), run multi-model after this server. Single-LLM scoring is fine for the default case.
|
|
65
|
+
- **Lazy Wrapper** — don't pass the raw JSON output of `score_codebase` into a chat. Render the report. The structured response is the input to a human-readable artifact, not the artifact itself.
|
|
66
|
+
|
|
67
|
+
For full anti-pattern definitions: <https://agentsfirst.dev/glossary/>.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Generated alongside [`@capitalthought/agentsfirst-mcp`](https://www.npmjs.com/package/@capitalthought/agentsfirst-mcp). Read the framework: <https://agentsfirst.dev/principles/>. The agent loads this file on session start; vague rules produce vague behaviour.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
© 2026 Joshua Baer
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# @capitalthought/agentsfirst-mcp
|
|
2
|
+
|
|
3
|
+
MCP server that scores any website or codebase against the [Agents First](https://agentsfirst.dev) framework. Use it to check how agent-ready a product is — yours, a competitor's, a portfolio company's, an acquisition target's.
|
|
4
|
+
|
|
5
|
+
Five verb-first tools, read-only, structured returns. Sister package to [`@capitalthought/create-agents-first`](https://www.npmjs.com/package/@capitalthought/create-agents-first) (the scaffold).
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
Run with no install:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx -y @capitalthought/agentsfirst-mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The server speaks MCP over stdio. Wire it into your agent runtime:
|
|
16
|
+
|
|
17
|
+
### Claude Code
|
|
18
|
+
|
|
19
|
+
```jsonc
|
|
20
|
+
// ~/.claude.json (or .claude/mcp.json)
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"agentsfirst": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "@capitalthought/agentsfirst-mcp"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Cursor
|
|
32
|
+
|
|
33
|
+
```jsonc
|
|
34
|
+
// .cursor/mcp.json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"agentsfirst": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "@capitalthought/agentsfirst-mcp"]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Windsurf / Cline / generic MCP-compatible clients
|
|
46
|
+
|
|
47
|
+
Same shape — `command: "npx"`, `args: ["-y", "@capitalthought/agentsfirst-mcp"]`. Drop into the client's MCP config.
|
|
48
|
+
|
|
49
|
+
## Tools
|
|
50
|
+
|
|
51
|
+
All tools are read-only. The server never writes anywhere.
|
|
52
|
+
|
|
53
|
+
### `agentsfirst_prep`
|
|
54
|
+
|
|
55
|
+
Prep Gate. Call this first, every session. Verifies the rubric is loaded (8 principles, 7 anti-patterns), Node >=20, and the canonical principles URL is reachable.
|
|
56
|
+
|
|
57
|
+
**Params:** none.
|
|
58
|
+
|
|
59
|
+
**Returns:** `{ ok, checks: [{ name, ok, message }], rubric_version, principles_url }`.
|
|
60
|
+
|
|
61
|
+
### `score_codebase`
|
|
62
|
+
|
|
63
|
+
Probes a local directory and scores it against the 8 principles. Looks for AGENTS.md, MCP/CLI/SDK presence, prep tooling, typed state, visible-output sinks, multi-model wiring, perspective dispatch, retry/recovery. 100 points total.
|
|
64
|
+
|
|
65
|
+
**Params:**
|
|
66
|
+
- `path` (string, default cwd) — directory to score.
|
|
67
|
+
- `depth` (`'quick' | 'standard' | 'deep'`, default `'standard'`) — reserved for future heuristics.
|
|
68
|
+
|
|
69
|
+
**Returns:** `{ score, level, level_name, principles, anti_patterns_flagged, top_moves, probe_signals }`.
|
|
70
|
+
|
|
71
|
+
### `score_website`
|
|
72
|
+
|
|
73
|
+
HTTP-probes a URL for agent-discoverable surfaces and scores against 5 dimensions: Discoverability (25), Content Accessibility (20), Bot Access Control (15), Agent Capabilities (30), Visibility of Agent Integrations (10). Looks for `robots.txt`, `/llms.txt`, `/AGENTS.md`, `/.well-known/*`, OpenAPI surfaces, MCP server card, and markdown content negotiation.
|
|
74
|
+
|
|
75
|
+
**Params:**
|
|
76
|
+
- `url` (string, required) — must be `http://` or `https://`.
|
|
77
|
+
|
|
78
|
+
**Returns:** `{ score, level, level_name, dimensions, anti_patterns_flagged, top_moves, probe_signals }`.
|
|
79
|
+
|
|
80
|
+
### `get_principle`
|
|
81
|
+
|
|
82
|
+
Returns the canonical text of one principle.
|
|
83
|
+
|
|
84
|
+
**Params:**
|
|
85
|
+
- `slug` — one of `interface-first`, `contract-first`, `prep-gates`, `typed-state`, `visible-outputs`, `multi-model-verification`, `perspective-dispatch`, `autonomous-recovery`.
|
|
86
|
+
|
|
87
|
+
**Returns:** `{ slug, name, summary, full_url, anti_patterns_defended }`.
|
|
88
|
+
|
|
89
|
+
### `get_anti_pattern`
|
|
90
|
+
|
|
91
|
+
Returns the canonical definition of one anti-pattern.
|
|
92
|
+
|
|
93
|
+
**Params:**
|
|
94
|
+
- `slug` — one of `lazy-wrapper`, `invisible-product`, `agents-without-rules`, `single-model-trust`, `slow-chatbot`, `ship-and-forget`, `god-server`.
|
|
95
|
+
|
|
96
|
+
**Returns:** `{ slug, name, definition, opposes_principle, glossary_url }`.
|
|
97
|
+
|
|
98
|
+
## What the score means
|
|
99
|
+
|
|
100
|
+
Total maps to a 0–4 adoption level:
|
|
101
|
+
|
|
102
|
+
| Score | Level | Name |
|
|
103
|
+
|------:|------:|------|
|
|
104
|
+
| 0–10 | 0 | No agent access |
|
|
105
|
+
| 11–25 | 1 | Agent as Afterthought |
|
|
106
|
+
| 26–60 | 2 | Agent-Aware |
|
|
107
|
+
| 61–85 | 3 | **Agents First** |
|
|
108
|
+
| 86–100 | 4 | Agent-Driven |
|
|
109
|
+
|
|
110
|
+
Aim for Level 3 on net-new projects. Lift legacy projects 1 → 2 → 3 incrementally.
|
|
111
|
+
|
|
112
|
+
Full rubric: <https://agentsfirst.dev/principles/>. Glossary of anti-patterns and metrics: <https://agentsfirst.dev/glossary/>.
|
|
113
|
+
|
|
114
|
+
## Local development
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
git clone https://github.com/capitalthought/agentsfirst
|
|
118
|
+
cd agentsfirst/tools/agentsfirst-mcp
|
|
119
|
+
npm install
|
|
120
|
+
npm run build
|
|
121
|
+
npm run prep # sanity-check the prep gate
|
|
122
|
+
node dist/server.js # boot the server (stdio)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Send a `tools/list` request over stdio:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/server.js | head -20
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Publishing
|
|
132
|
+
|
|
133
|
+
Same flow as `@capitalthought/create-agents-first`. Granular access token in 1Password Employee vault, scope-wide on `@capitalthought`, `bypass-2fa: true`. GitHub Actions auto-publishes on tag push (`v0.1.0`). Full reference: `~/icloud/Claude/ref-npm-publishing.md`.
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT — © 2026 Joshua Baer.
|
package/dist/prep.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CheckResult {
|
|
2
|
+
name: string;
|
|
3
|
+
ok: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PrepResult {
|
|
7
|
+
ok: boolean;
|
|
8
|
+
checks: CheckResult[];
|
|
9
|
+
rubric_version: string;
|
|
10
|
+
principles_url: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function runPrep(): Promise<PrepResult>;
|
package/dist/prep.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Prep Gate — pre-flight checks for the agentsfirst-mcp server.
|
|
2
|
+
//
|
|
3
|
+
// Two ways to run this:
|
|
4
|
+
// 1. As an MCP tool — agentsfirst_prep calls runPrep()
|
|
5
|
+
// 2. As a CLI — `npm run prep` for local debugging
|
|
6
|
+
//
|
|
7
|
+
// See https://agentsfirst.dev/principles/prep-gates/
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { ANTI_PATTERN_SLUGS, PRINCIPLE_SLUGS, PRINCIPLES_URL, RUBRIC_VERSION, } from './principles.js';
|
|
10
|
+
const CANONICAL_API = 'https://agentsfirst.dev/api/principles.json';
|
|
11
|
+
export async function runPrep() {
|
|
12
|
+
const checks = [];
|
|
13
|
+
// 1. Rubric loaded — 8 principles, 7 anti-patterns
|
|
14
|
+
checks.push({
|
|
15
|
+
name: 'rubric:principles',
|
|
16
|
+
ok: PRINCIPLE_SLUGS.length === 8,
|
|
17
|
+
message: PRINCIPLE_SLUGS.length === 8
|
|
18
|
+
? `8 principles loaded`
|
|
19
|
+
: `expected 8 principles, found ${PRINCIPLE_SLUGS.length}`,
|
|
20
|
+
});
|
|
21
|
+
checks.push({
|
|
22
|
+
name: 'rubric:anti-patterns',
|
|
23
|
+
ok: ANTI_PATTERN_SLUGS.length === 7,
|
|
24
|
+
message: ANTI_PATTERN_SLUGS.length === 7
|
|
25
|
+
? `7 anti-patterns loaded`
|
|
26
|
+
: `expected 7 anti-patterns, found ${ANTI_PATTERN_SLUGS.length}`,
|
|
27
|
+
});
|
|
28
|
+
// 2. Node version
|
|
29
|
+
const nodeMajor = parseInt(process.versions.node.split('.')[0] ?? '0', 10);
|
|
30
|
+
checks.push({
|
|
31
|
+
name: 'node:version',
|
|
32
|
+
ok: nodeMajor >= 20,
|
|
33
|
+
message: nodeMajor >= 20
|
|
34
|
+
? `node ${process.versions.node}`
|
|
35
|
+
: `node ${process.versions.node} — requires >= 20 (built-in fetch + AbortController)`,
|
|
36
|
+
});
|
|
37
|
+
// 3. Network reachable to canonical principles API (advisory — does not fail prep)
|
|
38
|
+
let networkOk = false;
|
|
39
|
+
let networkMsg = 'skipped';
|
|
40
|
+
try {
|
|
41
|
+
const ctrl = new AbortController();
|
|
42
|
+
const timeout = setTimeout(() => ctrl.abort(), 4000);
|
|
43
|
+
const res = await fetch(CANONICAL_API, {
|
|
44
|
+
method: 'HEAD',
|
|
45
|
+
headers: { 'User-Agent': 'agentsfirst-mcp/0.1' },
|
|
46
|
+
signal: ctrl.signal,
|
|
47
|
+
});
|
|
48
|
+
clearTimeout(timeout);
|
|
49
|
+
networkOk = true;
|
|
50
|
+
networkMsg = `HEAD ${CANONICAL_API} → ${res.status}`;
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
networkMsg = `${e.message} — offline scoring still works`;
|
|
54
|
+
}
|
|
55
|
+
checks.push({
|
|
56
|
+
name: 'network:agentsfirst.dev',
|
|
57
|
+
ok: true, // advisory
|
|
58
|
+
message: networkOk
|
|
59
|
+
? networkMsg
|
|
60
|
+
: `${networkMsg} (advisory only — local scoring is unaffected)`,
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
ok: checks.every((c) => c.ok),
|
|
64
|
+
checks,
|
|
65
|
+
rubric_version: RUBRIC_VERSION,
|
|
66
|
+
principles_url: PRINCIPLES_URL,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
// CLI mode — `npm run prep`
|
|
70
|
+
const isCli = (() => {
|
|
71
|
+
try {
|
|
72
|
+
return process.argv[1]
|
|
73
|
+
? process.argv[1].endsWith('prep.ts') || process.argv[1].endsWith('prep.js')
|
|
74
|
+
: false;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
})();
|
|
80
|
+
if (isCli) {
|
|
81
|
+
const result = await runPrep();
|
|
82
|
+
for (const c of result.checks) {
|
|
83
|
+
const prefix = c.ok ? '✅' : '❌';
|
|
84
|
+
process.stdout.write(`${prefix} ${c.name.padEnd(32)} ${c.message}\n`);
|
|
85
|
+
}
|
|
86
|
+
process.stdout.write(`\n${result.ok ? '✅' : '❌'} prep ${result.ok ? 'passed' : 'FAILED'} · rubric v${result.rubric_version}\n`);
|
|
87
|
+
// Silence the unused-import warning in CLI builds
|
|
88
|
+
void fileURLToPath;
|
|
89
|
+
process.exit(result.ok ? 0 : 1);
|
|
90
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const RUBRIC_VERSION = "0.6";
|
|
2
|
+
export declare const PRINCIPLES_URL = "https://agentsfirst.dev/principles/";
|
|
3
|
+
export declare const GLOSSARY_URL = "https://agentsfirst.dev/glossary/";
|
|
4
|
+
export type PrincipleSlug = 'interface-first' | 'contract-first' | 'prep-gates' | 'typed-state' | 'visible-outputs' | 'multi-model-verification' | 'perspective-dispatch' | 'autonomous-recovery';
|
|
5
|
+
export type AntiPatternSlug = 'lazy-wrapper' | 'invisible-product' | 'agents-without-rules' | 'single-model-trust' | 'slow-chatbot' | 'ship-and-forget' | 'god-server';
|
|
6
|
+
export interface Principle {
|
|
7
|
+
slug: PrincipleSlug;
|
|
8
|
+
name: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
full_url: string;
|
|
11
|
+
anti_patterns_defended: AntiPatternSlug[];
|
|
12
|
+
}
|
|
13
|
+
export interface AntiPattern {
|
|
14
|
+
slug: AntiPatternSlug;
|
|
15
|
+
name: string;
|
|
16
|
+
definition: string;
|
|
17
|
+
opposes_principle: PrincipleSlug;
|
|
18
|
+
glossary_url: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const PRINCIPLES: Record<PrincipleSlug, Principle>;
|
|
21
|
+
export declare const ANTI_PATTERNS: Record<AntiPatternSlug, AntiPattern>;
|
|
22
|
+
export declare const PRINCIPLE_SLUGS: PrincipleSlug[];
|
|
23
|
+
export declare const ANTI_PATTERN_SLUGS: AntiPatternSlug[];
|
|
24
|
+
/**
|
|
25
|
+
* Smallest-experiment guidance per principle — one concrete next move
|
|
26
|
+
* the consumer can ship today to earn the first points.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SMALLEST_EXPERIMENT: Record<PrincipleSlug, string>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Canonical Agents First definitions — the 8 principles + 7 anti-patterns.
|
|
2
|
+
//
|
|
3
|
+
// Source of truth: https://agentsfirst.dev/principles/ and https://agentsfirst.dev/glossary/
|
|
4
|
+
// These constants power get_principle and get_anti_pattern. Summaries are tight (~60 words)
|
|
5
|
+
// — for the full argument, link out to the canonical URLs.
|
|
6
|
+
export const RUBRIC_VERSION = '0.6';
|
|
7
|
+
export const PRINCIPLES_URL = 'https://agentsfirst.dev/principles/';
|
|
8
|
+
export const GLOSSARY_URL = 'https://agentsfirst.dev/glossary/';
|
|
9
|
+
export const PRINCIPLES = {
|
|
10
|
+
'interface-first': {
|
|
11
|
+
slug: 'interface-first',
|
|
12
|
+
name: 'Interface First',
|
|
13
|
+
summary: 'Design the agent interface — MCP server, CLI, or typed SDK — before any human UI. The first artifact of every feature is a verb-first tool definition with typed parameters and structured returns. The web app, mobile app, and integrations all become consumers of the same capability the agent uses. Aim for 10–20 well-chosen tools per server, not 200.',
|
|
14
|
+
full_url: 'https://agentsfirst.dev/principles/interface-first/',
|
|
15
|
+
anti_patterns_defended: ['invisible-product', 'lazy-wrapper', 'god-server', 'ship-and-forget'],
|
|
16
|
+
},
|
|
17
|
+
'contract-first': {
|
|
18
|
+
slug: 'contract-first',
|
|
19
|
+
name: 'Contract First',
|
|
20
|
+
summary: 'Write the usage rules — permissions, sequences, identifiers, formatting — in AGENTS.md before implementation. Tool definitions tell the agent what is possible; the contract tells it what is allowed. Without a contract agents hallucinate IDs, violate constraints, and create duplicates. Cost: one markdown file. Skip it and trust collapses on the first wrong action.',
|
|
21
|
+
full_url: 'https://agentsfirst.dev/principles/contract-first/',
|
|
22
|
+
anti_patterns_defended: ['agents-without-rules'],
|
|
23
|
+
},
|
|
24
|
+
'prep-gates': {
|
|
25
|
+
slug: 'prep-gates',
|
|
26
|
+
name: 'Prep Gates',
|
|
27
|
+
summary: 'Pre-flight checks before every agent session — validate credentials, load fresh IDs, confirm downstream services are healthy. Stale context is the #1 source of agent errors. Ship a verb-first <project>_prep tool with every server. Make AGENTS.md require it as the first call. Re-prep only on demand or after a stale-identifier error.',
|
|
28
|
+
full_url: 'https://agentsfirst.dev/principles/prep-gates/',
|
|
29
|
+
anti_patterns_defended: [],
|
|
30
|
+
},
|
|
31
|
+
'typed-state': {
|
|
32
|
+
slug: 'typed-state',
|
|
33
|
+
name: 'Typed State',
|
|
34
|
+
summary: 'All persistent agent state flows through one structured contract with versioned migrations. Each module owns its slice. Use enums not strings, schemas not JSON blobs, named transitions not free-text status updates. The schema is the coordination layer between autonomous jobs that cannot message each other directly.',
|
|
35
|
+
full_url: 'https://agentsfirst.dev/principles/typed-state/',
|
|
36
|
+
anti_patterns_defended: [],
|
|
37
|
+
},
|
|
38
|
+
'visible-outputs': {
|
|
39
|
+
slug: 'visible-outputs',
|
|
40
|
+
name: 'Visible Outputs',
|
|
41
|
+
summary: 'Agent actions produce human-readable artifacts in tools the human already opens — Slack, email, the task manager, the inbox — not a JSON blob in a dashboard nobody checks. Lead with the action ("Created task X in Project Alpha"). Identify the agent and moment. Surface failures the same way. Track human visibility rate as a first-class metric.',
|
|
42
|
+
full_url: 'https://agentsfirst.dev/principles/visible-outputs/',
|
|
43
|
+
anti_patterns_defended: [],
|
|
44
|
+
},
|
|
45
|
+
'multi-model-verification': {
|
|
46
|
+
slug: 'multi-model-verification',
|
|
47
|
+
name: 'Multi-Model Verification',
|
|
48
|
+
summary: 'For high-stakes decisions — deploys, security reviews, billing changes — fan the prompt out to three independent models in parallel and trust only what at least two agree on. Different vendors are best. Run findings through a cheap dedup model. Sort into consensus / disputed / single-model buckets. Apply selectively; verifying every tool call breaks the economics.',
|
|
49
|
+
full_url: 'https://agentsfirst.dev/principles/multi-model-verification/',
|
|
50
|
+
anti_patterns_defended: ['single-model-trust'],
|
|
51
|
+
},
|
|
52
|
+
'perspective-dispatch': {
|
|
53
|
+
slug: 'perspective-dispatch',
|
|
54
|
+
name: 'Perspective Dispatch',
|
|
55
|
+
summary: 'Complex reviews dispatch multiple constrained perspectives — security, UX, new-user, performance — against the same artifact in parallel. Each persona has a defined focus area and a fixed severity scale; findings outside the focus get discarded. The constraint sharpens each reviewer; aggregation produces a single actionable report in minutes instead of weeks of calendar time.',
|
|
56
|
+
full_url: 'https://agentsfirst.dev/principles/perspective-dispatch/',
|
|
57
|
+
anti_patterns_defended: [],
|
|
58
|
+
},
|
|
59
|
+
'autonomous-recovery': {
|
|
60
|
+
slug: 'autonomous-recovery',
|
|
61
|
+
name: 'Autonomous Recovery',
|
|
62
|
+
summary: 'Retry transient errors with exponential backoff and a budget; do not retry permanent ones. Make every operation idempotent. Do not alert on the first failure — alert on a sustained pattern. When self-healing genuinely fails, escalate with what happened, what was tried, and a direct link to take manual action. Failing well is the discipline.',
|
|
63
|
+
full_url: 'https://agentsfirst.dev/principles/autonomous-recovery/',
|
|
64
|
+
anti_patterns_defended: ['slow-chatbot'],
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
export const ANTI_PATTERNS = {
|
|
68
|
+
'lazy-wrapper': {
|
|
69
|
+
slug: 'lazy-wrapper',
|
|
70
|
+
name: 'The Lazy Wrapper',
|
|
71
|
+
definition: 'The agent interface is just fetch() with a different name. No domain knowledge, no validation, no structured errors — the agent asks for active deals and gets back 47KB of nested JSON with undocumented field names. Handing someone the raw database and calling it a product.',
|
|
72
|
+
opposes_principle: 'interface-first',
|
|
73
|
+
glossary_url: 'https://agentsfirst.dev/glossary/#lazy-wrapper',
|
|
74
|
+
},
|
|
75
|
+
'invisible-product': {
|
|
76
|
+
slug: 'invisible-product',
|
|
77
|
+
name: 'The Invisible Product',
|
|
78
|
+
definition: 'Ship the web app, expose a REST API later, never think about agent access. Your product does not exist to the agent ecosystem. When a developer\'s agent needs to do the job your product was built for, it picks a competitor that\'s actually in the tool list. The cost is silent — you never enter consideration.',
|
|
79
|
+
opposes_principle: 'interface-first',
|
|
80
|
+
glossary_url: 'https://agentsfirst.dev/glossary/#invisible-product',
|
|
81
|
+
},
|
|
82
|
+
'agents-without-rules': {
|
|
83
|
+
slug: 'agents-without-rules',
|
|
84
|
+
name: 'Agents Without Rules',
|
|
85
|
+
definition: 'No AGENTS.md, no usage constraints, no sequencing requirements, no permissions matrix. The agent hallucinates identifiers, violates rate limits, creates duplicate records, and emails the wrong customers. Then someone says "AI doesn\'t work" and turns it off.',
|
|
86
|
+
opposes_principle: 'contract-first',
|
|
87
|
+
glossary_url: 'https://agentsfirst.dev/glossary/#agents-without-rules',
|
|
88
|
+
},
|
|
89
|
+
'single-model-trust': {
|
|
90
|
+
slug: 'single-model-trust',
|
|
91
|
+
name: 'Single-Model Trust',
|
|
92
|
+
definition: 'Acting on one LLM\'s "looks safe" recommendation for decisions that cost money or affect users — billing changes, deploys, security reviews. A coin flip dressed up as confidence. The model misses the auth bypass because the auth bypass looks like normal code; the model is being a single point of failure on decisions where one is unacceptable.',
|
|
93
|
+
opposes_principle: 'multi-model-verification',
|
|
94
|
+
glossary_url: 'https://agentsfirst.dev/glossary/#single-model-trust',
|
|
95
|
+
},
|
|
96
|
+
'slow-chatbot': {
|
|
97
|
+
slug: 'slow-chatbot',
|
|
98
|
+
name: 'The Slow Chatbot',
|
|
99
|
+
definition: 'Requiring human approval for every agent action. If the agent can\'t do anything without asking permission, it\'s not an agent — it\'s a chatbot with extra steps. Defeats the entire point of automation.',
|
|
100
|
+
opposes_principle: 'autonomous-recovery',
|
|
101
|
+
glossary_url: 'https://agentsfirst.dev/glossary/#slow-chatbot',
|
|
102
|
+
},
|
|
103
|
+
'ship-and-forget': {
|
|
104
|
+
slug: 'ship-and-forget',
|
|
105
|
+
name: 'Ship and Forget',
|
|
106
|
+
definition: 'Launch an agent integration for the press release, then never maintain it. Agents try to use it, hit broken auth or stale schemas, fail, and develop a negative association with your product. Worse than not having one.',
|
|
107
|
+
opposes_principle: 'interface-first',
|
|
108
|
+
glossary_url: 'https://agentsfirst.dev/glossary/#ship-and-forget',
|
|
109
|
+
},
|
|
110
|
+
'god-server': {
|
|
111
|
+
slug: 'god-server',
|
|
112
|
+
name: 'The God Server',
|
|
113
|
+
definition: 'An agent interface exposing 200 tools because it wraps an entire platform. Agents choke on tool selection when there are too many options, and the tool definitions alone can consume 50%+ of a context window before any work happens. Ten well-chosen tools beat two hundred exhaustive ones.',
|
|
114
|
+
opposes_principle: 'interface-first',
|
|
115
|
+
glossary_url: 'https://agentsfirst.dev/glossary/#god-server',
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
export const PRINCIPLE_SLUGS = Object.keys(PRINCIPLES);
|
|
119
|
+
export const ANTI_PATTERN_SLUGS = Object.keys(ANTI_PATTERNS);
|
|
120
|
+
/**
|
|
121
|
+
* Smallest-experiment guidance per principle — one concrete next move
|
|
122
|
+
* the consumer can ship today to earn the first points.
|
|
123
|
+
*/
|
|
124
|
+
export const SMALLEST_EXPERIMENT = {
|
|
125
|
+
'interface-first': 'Wrap your single most-used operation as one verb-first MCP tool with a Zod-typed parameter schema and a structured return. Ship it, measure time-to-first-agent-action, expand from there.',
|
|
126
|
+
'contract-first': 'Add an AGENTS.md at the repo root covering Permissions, Required Prep, Identifiers, Sequence, and Errors. One file. The agent loads it on session start.',
|
|
127
|
+
'prep-gates': 'Add a <project>_prep MCP tool that validates env, loads fresh IDs, and pings downstream services. Make AGENTS.md require it as the first call of every session.',
|
|
128
|
+
'typed-state': 'Replace the largest free-text status column with a Zod enum and a numbered migration. Generate the agent\'s tool params from the same schema.',
|
|
129
|
+
'visible-outputs': 'On every successful write tool, post a one-line human-readable artifact to Slack or email. Lead with the verb. Include a clickable link back to the action.',
|
|
130
|
+
'multi-model-verification': 'For your highest-stakes write (deploy, billing change, mass email), fan the decision out to Claude + GPT + Gemini. Act only on findings two of three agree on.',
|
|
131
|
+
'perspective-dispatch': 'Add three reviewer personas (security, UX, new-user) with constrained system prompts. Run them in parallel against your next design doc; aggregate by severity.',
|
|
132
|
+
'autonomous-recovery': 'Wrap every external call in a withRetry() helper with exponential backoff (1s, 2s, 4s, 8s, jitter) and a 5-attempt budget. On exhaustion, escalate with what/tried/manual-action.',
|
|
133
|
+
};
|