agent-first-data 0.17.1 → 0.17.3
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-first-data
|
|
3
|
-
description: Apply Agent-First Data naming, redaction, formatting, protocol
|
|
3
|
+
description: Apply and review the formal Agent-First Data specification using the Rust/Go/Python/TypeScript libraries or afdata CLI for naming, redaction, formatting, protocol envelopes, logging, linting, and validation. Use proactively when writing or reviewing structured data, configs, logs, transport payloads, database/wire fields, CLI output, or compatibility-sensitive public and persistent field names.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!-- Canonical source: skills/agent-first-data/SKILL.md.
|
|
@@ -11,12 +11,67 @@ description: Apply Agent-First Data naming, redaction, formatting, protocol enve
|
|
|
11
11
|
|
|
12
12
|
Use AFDATA when naming fields or reviewing structured output. The contract is naming-based: suffixes communicate units, formatting, and redaction semantics without relying on free-text inference.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Specification workflow
|
|
15
|
+
|
|
16
|
+
Treat the formal specification as normative, not the skill summary or an
|
|
17
|
+
example payload. In a repository checkout, read these spore-root-relative
|
|
18
|
+
sources as needed:
|
|
19
|
+
|
|
20
|
+
- `spec/agent-first-data.md` — complete cross-language naming, formatting,
|
|
21
|
+
redaction, protocol, logging, and CLI contract.
|
|
22
|
+
- `spec/registry.json` — exact suffix metadata.
|
|
23
|
+
- `spec/protocol-v1.schema.json` — protocol event schema.
|
|
24
|
+
- `spec/fixtures/` — cross-language conformance cases.
|
|
25
|
+
|
|
26
|
+
When only the installed skill is available, use the bundled equivalents:
|
|
15
27
|
|
|
16
28
|
- `references/rules.md` — detailed suffix rules, output formatting, protocol templates, logging, CLI flags, and review checklist.
|
|
17
29
|
- `references/registry.json` — machine-readable suffix registry; use this as the exact source for suffix metadata.
|
|
18
30
|
- `references/protocol-v1.schema.json` — protocol event schema for `kind:"result"`, `kind:"error"`, `kind:"progress"`, and `kind:"log"` envelopes.
|
|
19
31
|
|
|
32
|
+
If an example or README conflicts with the formal spec, follow the spec and
|
|
33
|
+
report the discrepancy. Do not invent suffix meanings or reduce the protocol
|
|
34
|
+
schema.
|
|
35
|
+
|
|
36
|
+
## Library workflow
|
|
37
|
+
|
|
38
|
+
Use the library at serialization boundaries so redaction and formatting are
|
|
39
|
+
not reimplemented ad hoc. Rust applications can build a typed protocol event
|
|
40
|
+
and render it in the required output format:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cargo add agent-first-data --no-default-features
|
|
44
|
+
pip install agent-first-data
|
|
45
|
+
npm install agent-first-data
|
|
46
|
+
go get github.com/agentfirstkit/agent-first-data/go
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```rust
|
|
50
|
+
use agent_first_data::{json_result, output_json};
|
|
51
|
+
use serde_json::json;
|
|
52
|
+
|
|
53
|
+
let event = json_result(json!({
|
|
54
|
+
"latency_ms": 1280,
|
|
55
|
+
"api_key_secret": "sk-live-example",
|
|
56
|
+
})).build()?;
|
|
57
|
+
let rendered = output_json(event.as_value());
|
|
58
|
+
assert!(rendered.contains("\"api_key_secret\":\"***\""));
|
|
59
|
+
# Ok::<(), agent_first_data::BuildError>(())
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For a finite CLI execution implemented in Rust, create one `CliEmitter`, select
|
|
63
|
+
`OutputFormat` through `cli_parse_output`, enable strict protocol, and emit one
|
|
64
|
+
terminal result or error. Handle version before clap with
|
|
65
|
+
`cli_handle_version_or_continue` and `VersionConfig::conventional_default()`.
|
|
66
|
+
For non-CLI HTTP/MCP/SSE serialization, call `redacted_value()` or
|
|
67
|
+
`redact_url_secrets()` explicitly at the boundary.
|
|
68
|
+
|
|
69
|
+
The same library contract is available for Go, Python, and TypeScript. Use the
|
|
70
|
+
runtime's native names while preserving the same builders, output formats,
|
|
71
|
+
redaction behavior, registry, schema, and conformance fixtures; consult its
|
|
72
|
+
root-level `go/README.md`, `python/README.md`, or `typescript/README.md` when
|
|
73
|
+
working in that runtime.
|
|
74
|
+
|
|
20
75
|
## Naming and redaction decisions
|
|
21
76
|
|
|
22
77
|
- Add unit suffixes to ambiguous numeric fields: `_ms`, `_s`, `_bytes`, `_percent`, `_sats`, `_msats`, currency suffixes, and timestamp suffixes.
|
|
@@ -28,7 +83,11 @@ Use AFDATA when naming fields or reviewing structured output. The contract is na
|
|
|
28
83
|
## Evaluation rules
|
|
29
84
|
|
|
30
85
|
- Trigger this skill for field naming, structured output, configs, logs, CLI output, protocol events, MCP/HTTP/SSE payloads, database columns, wire fields, or persisted JSON. Do not wait for the user to say "AFDATA" when the work changes those surfaces.
|
|
31
|
-
-
|
|
86
|
+
- In a repository checkout, treat `spec/agent-first-data.md`,
|
|
87
|
+
`spec/registry.json`, and `spec/protocol-v1.schema.json` as authoritative; in
|
|
88
|
+
an installed skill, use their bundled `references/` equivalents. Do not
|
|
89
|
+
replace them with invented suffix meanings, a reduced schema, or free-text
|
|
90
|
+
interpretation.
|
|
32
91
|
- For secrets, fix the field name or serializer configuration. Use `_secret` or configured exact secret names; do not rely on scanning arbitrary strings or object debug output.
|
|
33
92
|
- Run `afdata lint` on JSON/JSONL examples, JSON Schema, MCP schemas, or serialized samples when the CLI is available. Run `afdata validate` on finite protocol events/streams. If a check cannot run, report that explicitly.
|
|
34
93
|
- Before modifying an external project's public API, wire format, database schema, or persisted field names, stop and report the compatibility impact; request approval before applying the change.
|
|
@@ -43,15 +102,26 @@ One-time CLI output uses `json_log()` or `CliEmitter` for a single event; serial
|
|
|
43
102
|
|
|
44
103
|
## CLI workflow
|
|
45
104
|
|
|
46
|
-
|
|
105
|
+
Install `afdata` when a shell workflow needs validation, formatting, or skill
|
|
106
|
+
administration without embedding a library:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
cargo install agent-first-data
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Use it for deterministic checks:
|
|
47
113
|
|
|
48
114
|
```bash
|
|
49
|
-
afdata lint
|
|
50
|
-
afdata validate
|
|
115
|
+
afdata lint payload.json
|
|
116
|
+
afdata validate events.jsonl
|
|
117
|
+
afdata format payload.json --output yaml
|
|
118
|
+
afdata skill validate skills/example-skill
|
|
51
119
|
```
|
|
52
120
|
|
|
53
121
|
- Run `afdata lint` for ordinary JSON/JSONL, JSON Schema, or MCP input/output schemas.
|
|
54
122
|
- Run `afdata validate` for AFDATA protocol events or finite event streams.
|
|
123
|
+
- Omit the input path to read stdin. `--output` accepts `json`, `yaml`, or
|
|
124
|
+
`plain`.
|
|
55
125
|
- Treat findings as contract issues unless the owning tool intentionally documents a non-AFDATA field.
|
|
56
126
|
|
|
57
127
|
## Review checklist
|