Analyzer — Protocol
Step 1 of 3 in the parity-test-b pipeline. Reads the input JSON file, checks each top-level value for null and type inconsistency issues, writes findings.json to the temp directory.
Inputs (from dispatch context)
input_path — absolute path to the input JSON file.
findings_output_path — absolute path for findings.json (temp directory).
state_path — absolute path to pipeline-state.json.
run_id — current run ID string.
root — resolved scope root ({ROOT}).
Protocol
PHASE 1: VALIDATE INPUT
- Check
input_path exists. If missing: emit NEEDS_CONTEXT — STOP.
- Parse as JSON. If invalid: emit
BLOCKED with parse error — STOP.
- Confirm root is a JSON object. If not: emit
BLOCKED — STOP.
PHASE 2: ANALYZE KEYS
For each top-level key:
- Determine the JSON type of its value:
string, number, boolean, object, array, null.
- Record
is_null: true if value is JSON null.
- For arrays: check whether all elements share the same JSON type. Record
type_inconsistent: true if elements have mixed types; record mixed_types: ["{type1}", "{type2}", ...].
- Accumulate entry:
{ "key": "...", "type": "...", "is_null": bool, "type_inconsistent": bool, "issue_count": N }.
PHASE 3: WRITE FINDINGS
Write findings.json to findings_output_path:
{
"source_path": "{input_path}",
"analyzed_at": "{iso8601_utc}",
"total_keys": {N},
"issue_count": {total_issues},
"keys": [
{
"key": "{key}",
"type": "{json_type}",
"is_null": false,
"type_inconsistent": false,
"issue_count": 0
}
]
}
PHASE 4: UPDATE STATE AND EMIT STATUS
- Update
pipeline-state.json:
phases[0].status → "completed"
phases[0].outputs → [{ "findings_path": "{findings_output_path}", "issue_count": {N} }]
- Emit:
DONE / DONE_WITH_CONCERNS (issues found) / NEEDS_CONTEXT / BLOCKED.
Invariants
- NEVER hardcode platform paths.
- ALWAYS update
pipeline-state.json before emitting terminal status.
- Emit exactly one terminal status:
DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED.
1---2name: analyzer-protocol-23description: Loaded by the analyzer agent of parity-test-b to supply its operating protocol. Not user-invocable.4---56# Analyzer — Protocol78> Step 1 of 3 in the `parity-test-b` pipeline. Reads the input JSON file, checks each top-level value for null and type inconsistency issues, writes `findings.json` to the temp directory.910## Inputs (from dispatch context)1112- `input_path` — absolute path to the input JSON file.13- `findings_output_path` — absolute path for `findings.json` (temp directory).14- `state_path` — absolute path to `pipeline-state.json`.15- `run_id` — current run ID string.16- `root` — resolved scope root (`{ROOT}`).1718## Protocol1920### PHASE 1: VALIDATE INPUT21221. Check `input_path` exists. If missing: emit `NEEDS_CONTEXT` — STOP.232. Parse as JSON. If invalid: emit `BLOCKED` with parse error — STOP.243. Confirm root is a JSON object. If not: emit `BLOCKED` — STOP.2526### PHASE 2: ANALYZE KEYS2728For each top-level key:29301. Determine the JSON type of its value: `string`, `number`, `boolean`, `object`, `array`, `null`.312. Record `is_null: true` if value is JSON null.323. For arrays: check whether all elements share the same JSON type. Record `type_inconsistent: true` if elements have mixed types; record `mixed_types: ["{type1}", "{type2}", ...]`.334. Accumulate entry: `{ "key": "...", "type": "...", "is_null": bool, "type_inconsistent": bool, "issue_count": N }`.3435### PHASE 3: WRITE FINDINGS3637Write `findings.json` to `findings_output_path`:3839```json40{41 "source_path": "{input_path}",42 "analyzed_at": "{iso8601_utc}",43 "total_keys": {N},44 "issue_count": {total_issues},45 "keys": [46 {47 "key": "{key}",48 "type": "{json_type}",49 "is_null": false,50 "type_inconsistent": false,51 "issue_count": 052 }53 ]54}55```5657### PHASE 4: UPDATE STATE AND EMIT STATUS58591. Update `pipeline-state.json`:60 - `phases[0].status` → `"completed"`61 - `phases[0].outputs` → `[{ "findings_path": "{findings_output_path}", "issue_count": {N} }]`622. Emit: `DONE` / `DONE_WITH_CONCERNS` (issues found) / `NEEDS_CONTEXT` / `BLOCKED`.6364## Invariants6566- NEVER hardcode platform paths.67- ALWAYS update `pipeline-state.json` before emitting terminal status.68- Emit exactly one terminal status: `DONE` / `DONE_WITH_CONCERNS` / `NEEDS_CONTEXT` / `BLOCKED`.