judged-feedback
CLAUDE.md0 starsChanged 51 days agoMITView on GitHub
This is a Jupyter notebook demo (demo.ipynb) that builds a product-feedback analysis pipeline for a synthetic first-party retailer. The notebook is the published artifact; cell outputs from a recorded run are committed. API keys are captured into Python variables in Section 4 and never printed, never passed as shell arguments. The agent key is also written by PyYAML into the CLI config file (out/elasticrc.yml, the CLI's own credential store) as the agent context; the CLI has no stdin/env path for…
- Reads credentials
In this repositoryOne other file it gives its agents.
- feedback-triageSkill
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 84
Follow this sequence from assets/plan.md §11.5:
- Very specific: line 93
Write-up: assets/article.md, image prompts, images
- Very specific: line 111
Before writing any !elastic cell or the feedback-triage skill, read the installed Elastic Agent Skills (npx skills add …
≈ “Common” is an estimate: at least 1 in 5 of the 28,029 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
# Install dependencies
uv sync
# Launch the notebook
uv run jupyter lab demo.ipynb
# Run the whole notebook non-interactively (there is no per-section run)
uv run jupyter nbconvert --to notebook --execute --inplace demo.ipynb
# Resize a generated image to its article preset (cover | arch | section, or WxH)
assets/images/resize.sh section ~/Downloads/generated.png assets/images/section1.png
# Verify CLI tools are present
elastic --version
claude --versionArchitecture
This is a Jupyter notebook demo (demo.ipynb) that builds a product-feedback analysis pipeline for a synthetic first-party retailer. The notebook is the published artifact; cell outputs from a recorded run are committed.
Three principals with distinct scopes
| Principal | Credential | Elasticsearch access |
| Human/admin | CLI --save-as admin context | read + write all indices |
| Batch job | BATCH_KEY (in-memory only) | read feedback-raw, products; write feedback-judgments |
Agent (claude -p) | AGENT_KEY (in-memory, and stored as the CLI agent context credential) | read-only all indices; outputs files to out/ only |
API keys are captured into Python variables in Section 4 and never printed, never passed as shell arguments. The agent key is also written by PyYAML into the CLI config file (out/elasticrc.yml, the CLI's own credential store) as the agent context; the CLI has no stdin/env path for it. The Elastic Cloud key (EC_API_KEY) gets the same treatment in Section 1: PyYAML writes the cloud context into that file (mode 0600) rather than elastic config context add --cloud-api-key. The batch key lives only in memory. agent is the current context from Section 4 on; admin cells always pass --use-context admin.
Data flow
synth.py → feedback-raw (append-only)
→ products (catalog)
judge.py + Jev API → feedback-judgments (one doc per feedback_id × rubric_version)
claude -p (agent context, read-only) → out/report.md + out/actions.ndjson
Human reads report → executes approved elastic commands from admin contextKey indices
feedback-raw: source-of-truth reviews and returns; never modified after ingestfeedback-judgments: one doc per(feedback_id, rubric_version); denormalized keys for ES|QL aggregation; Choice answers stored as{label, confidence}objects;probabilitiesmap stored withenabled: false(in_sourceonly, not indexed);severity.scorearrives from Jev as a fractional 0–3 value (e.g.0.85) although the mapping types itintegerproducts: catalog; proposable fields arefit_note,fit_guidance,known_issues,availableonly
Jev (TypeSafe AI) judge
judge.py calls POST https://api.typesafe.ai/v1/systemone with {"model": "jev-latest", "state": <item>, "questions": <rubric>}. Question types: choice, score, noul. Retry on 429/529/5xx with jittered exponential backoff via tenacity; 400/401 are not retried. Each answer in the response carries type; judge._flatten reads noul (float) for nouls, choice/confidence/probabilities for choices, and score (float)/confidence for scores. These names came from a live smoke test; re-check against a raw response if the API changes. Before the batch, judge.run_labeled gates the rubric against assets/data/labeled.json (≥ 27/30; the recorded run scored 27/30).
Agent constraints
The claude -p invocation in Section 7 passes explicit --allowedTools on the command line. The .claude/settings.json deny rules apply for interactive development in this repo:
{
"permissions": {
"deny": [
"Bash(curl *)", "Bash(wget *)", "Bash(python*)", "Bash(uv *)", "Bash(jq *)",
"Read(assets/rules/**)", "Edit(assets/rules/**)",
"Read(.env)", "Read(~/.elasticrc.yml)", "Read(~/.config/**)"
]
}
}Rubric versioning
assets/rules/rubric_v1.json is the versioned Jev question set. Changing it bumps the version; judge.py selects items missing the current version so re-judging is incremental. The agent cannot read or write this file.
Build order
Follow this sequence from assets/plan.md §11.5:
assets/rules/rubric_v1.json— smoke-test one review against Jev and print raw responsesrc/judged_feedback/synth.py—write_fixtures()emitsassets/data/{products,feedback}.ndjson,labeled.json, and theplanted_signals.jsonsidecar; check the table viaprint_planted_signals()src/judged_feedback/judge.py— run on labeled set; tune rubric until ≥27/30 agreement- Notebook Sections 1–4 against a live project; verify each
!elasticcell with--helpfirst - Sections 5–6
.claude/skills/feedback-triage/SKILL.md,assets/prompts/agent-task.md,.claude/settings.json— then Section 7 (expect 2–3 iterations)- Sections 8–9 (human executes, teardown); run the whole notebook twice from a clean machine
- Write-up:
assets/article.md, image prompts, images
Status: steps 1–7 are built and the notebook is committed with outputs from a recorded run (all five planted signals found, no finding on the shipping decoys, two approved commands executed). Open items: the two clean-machine runs, and the README's "left out for production" paragraph. The checklist is in assets/plan.md §9.
Write-up
assets/article.mdis the published narrative for Sections 1–7 (Section 8 is one bullet). The notebook's markdown cells are titles only (## Section N — Title).- The article does not argue the agent's restrictions (that was the
leashed-agentarticle); it covers Jev judging, Elasticsearch aggregation, and the agent's recommendations. - Image-generation prompts live in
assets/prompts/(prompt_cover.txt,prompt_arch.txt,prompt_section{1..7}.txt). Generated images go throughassets/images/resize.sh, whose presets arecover1920×1080,arch1600×1000, andsection900×300.
Environment
.env holds only EC_API_KEY (Elastic Cloud) and TYPESAFE_API_KEY. The admin Elasticsearch credential is stored by the CLI after --save-as admin; Python never reads it. Python cells take the Elasticsearch endpoint from out/project.json (Section 1 output), never from the CLI config.
Reference
The leashed-agent repo (https://github.com/joeywhelan/leashed-agent) is the reference for notebook style, provisioning cells, and the claude -p invocation. Its ~/.elasticrc.yml edit/restore pattern is replaced here by a per-run out/elasticrc.yml selected with ELASTIC_CLI_CONFIG_FILE; ~/.elasticrc.yml is never read or changed. Reuse its patterns; do not reuse its scenario.
Before writing any !elastic cell or the feedback-triage skill, read the installed Elastic Agent Skills (npx skills add elastic/agent-skills) for command patterns and ES|QL guidance.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

