Skip to content

feat: add capabilities and problems registries with captain skills - #98

Closed
harsh9200 wants to merge 4 commits into
kunchenguid:mainfrom
harsh9200:fm/capabilities-registry-c8
Closed

harsh9200 wants to merge 4 commits into
kunchenguid:mainfrom
harsh9200:fm/capabilities-registry-c8

Conversation

@harsh9200

Copy link
Copy Markdown

Intent

The developer (acting as captain managing the firstmate orchestration system) directed a crewmate to build a capabilities and problems registry for firstmate-on-itself, working from a written spec at .lavish/firstmate-ios/capabilities-registry-spec.md. The goal was three artifacts: a tracked CAPABILITIES.md living manifest accurately surveying the real environment's tools, MCPs, skills, and quality gates with their limits; a tracked PROBLEMS.md registry using an explicit consistent schema (problem, symptom, impact, suspected root cause, candidate fix/tool, status); and two captain-invocable skills, propose-tool and report-problem, each appending a structured entry to the right registry and queuing an evaluation. They required a minimal AGENTS.md edit (kept in its own section to rebase cleanly against a concurrent watcher fix touching sections 3/5/8) pointing to the manifest and both skills. They explicitly mandated exactly one Codex CLI review pass over the committed diff (checking schema consistency and that skills append valid entries), with real fixes applied and committed but no second pass, before validating through the no-mistakes pipeline.

What Changed

  • Added two tracked registries at the repo root: CAPABILITIES.md, a living manifest of tools, MCP servers, skills, and quality gates with their known limits, and PROBLEMS.md, a recurring-problem registry with an explicit schema (problem, symptom, impact, suspected root cause, candidate fix/tool, status).
  • Added the captain-invocable propose-tool and report-problem skills plus the shared bin/fm-registry.sh helper they call, which appends a schema-exact entry to the matching registry and queues an evaluation pointer; covered by the new hermetic tests/fm-registry.test.sh suite.
  • Wired the new artifacts into the docs: a new AGENTS.md section 14 pointing to both registries and skills, and updates to CONTRIBUTING.md, README.md, and docs/scripts.md, including a Document-gate sync of the tracked-file lists to include the two new registries.

Risk Assessment

✅ Low: Additive change of documentation registries plus one well-guarded append helper whose substantive issues were already fixed in a prior review pass; schemas are consistent and only minor latent fragilities remain.

Testing

Baseline checks (bash -n, --help) passed, then I drove the helper that backs both captain skills end-to-end in a sandboxed FM_ROOT and confirmed propose-tool/report-problem append entries whose fields match the declared registry schemas byte-for-byte and queue a corresponding evaluation line, including all Codex-review hardening paths (collision suffixing, slug fallback, --fix default, input validation, and the queue-preflight guard that prevents an orphaned registry entry). I also reviewed the three docs/skills artifacts and the contained AGENTS.md section 14 for correctness and link resolution. No existing test covered this script, so I added a hermetic tests/fm-registry.test.sh (matching the repo's tests/lib.sh convention and CI discovery) that locks in the schema-consistency, queue, and safety behaviors; it passes 6/6. This is a CLI/markdown change with no rendered UI surface, so the reviewer-visible evidence is a CLI transcript plus the generated registry/queue markdown rather than a screenshot. All testing wrote to the evidence dir and temp sandboxes only; the change under test is untouched and the sole working-tree addition is the intentional new test file.

Evidence: End-to-end CLI transcript: captain runs /propose-tool and /report-problem (commands, confirmations, generated CAPABILITIES.md/PROBLEMS.md entries, and queued evaluations)
# fm-registry end-to-end transcript (captain skill flow)

Exercised `bin/fm-registry.sh` (the helper backing /propose-tool and /report-problem)
against copies of the real tracked registries via FM_ROOT_OVERRIDE.

## 1. Captain runs /propose-tool
`` `
$ bin/fm-registry.sh propose-tool --tool "ripgrep (rg)" \
    --replaces "grep for fleet-wide code search" \
    --why "10-50x faster on large clones, respects .gitignore by default, fewer false hits" \
    --notes "already a common dependency; install via brew"
recorded T-20260627-030509-ripgrep-rg in CAPABILITIES.md and queued its evaluation in .../data/evaluation-queue.md
`` `

### -> appended to CAPABILITIES.md "Proposed tools" section
`` `
### T-20260627-030509-ripgrep-rg - ripgrep (rg)
- **Tool:** ripgrep (rg)
- **Replaces:** grep for fleet-wide code search
- **Why better:** 10-50x faster on large clones, respects .gitignore by default, fewer false hits
- **Notes:** already a common dependency; install via brew
- **Status:** proposed
- **Proposed:** 2026-06-27
`` `

## 2. Captain runs /report-problem
`` `
$ bin/fm-registry.sh report-problem --problem "Peeking panes too often burns context budget" \
    --symptom "repeated full-pane peeks during supervision inflate token use late in a session" \
    --impact "faster context growth, earlier decoder-flip risk on long sessions" \
    --cause "defaulting to pane peeks instead of reading the ~30-token status file first" \
    --fix "status-file-first discipline; cap peeks at 40 lines"
recorded P-20260627-030509-peeking-panes-too-often-burns-co in PROBLEMS.md and queued its evaluation in .../data/evaluation-queue.md
`` `

### -> appended to PROBLEMS.md "Registry" section
`` `
### P-20260627-030509-peeking-panes-too-often-burns-co - Peeking panes too often burns context budget
- **Problem:** Peeking panes too often burns context budget
- **Symptom:** repeated full-pane peeks during supervision inflate token use late in a session
- **Impact:** faster context growth, earlier decoder-flip risk on long sessions
- **Suspected root cause:** defaulting to pane peeks instead of reading the ~30-token status file first
- **Candidate fix / tool:** status-file-first discipline; cap peeks at 40 lines
- **Status:** reported
- **Reported:** 2026-06-27
`` `

## 3. Both queued an evaluation (fleet-local data/evaluation-queue.md)
`` `
- [ ] evaluate tool proposal T-20260627-030509-ripgrep-rg (ripgrep (rg), replaces grep for fleet-wide code search) -> CAPABILITIES.md (filed 2026-06-27)
- [ ] evaluate problem P-20260627-030509-peeking-panes-too-often-burns-co (Peeking panes too often burns context budget) -> PROBLEMS.md (filed 2026-06-27)
- [ ] evaluate tool proposal T-20260627-030536-dupe (dupe, replaces x) -> CAPABILITIES.md (filed 2026-06-27)
- [ ] evaluate tool proposal T-20260627-030536-dupe-2 (dupe, replaces x) -> CAPABILITIES.md (filed 2026-06-27)
- [ ] evaluate problem P-20260627-030536-entry (??? 上海 !!!) -> PROBLEMS.md (filed 2026-06-27)
- [ ] evaluate problem P-20260627-030536-nofix-case (nofix case) -> PROBLEMS.md (filed 2026-06-27)
`` `
Evidence: Generated proposed-tool entry appended to CAPABILITIES.md (schema-exact)
### T-20260627-030509-ripgrep-rg - ripgrep (rg)
- **Tool:** ripgrep (rg)
- **Replaces:** grep for fleet-wide code search
- **Why better:** 10-50x faster on large clones, respects .gitignore by default, fewer false hits
- **Notes:** already a common dependency; install via brew
- **Status:** proposed
- **Proposed:** 2026-06-27
Evidence: Generated problem entry appended to PROBLEMS.md (schema-exact) + queued evaluations
### P-20260627-030509-peeking-panes-too-often-burns-co - Peeking panes too often burns context budget
- **Problem:** Peeking panes too often burns context budget
- **Symptom:** repeated full-pane peeks during supervision inflate token use late in a session
- **Impact:** faster context growth, earlier decoder-flip risk on long sessions
- **Suspected root cause:** defaulting to pane peeks instead of reading the ~30-token status file first
- **Candidate fix / tool:** status-file-first discipline; cap peeks at 40 lines
- **Status:** reported
- **Reported:** 2026-06-27

# evaluation-queue.md:
- [ ] evaluate tool proposal T-20260627-030509-ripgrep-rg (ripgrep (rg), replaces grep for fleet-wide code search) -> CAPABILITIES.md (filed 2026-06-27)
- [ ] evaluate problem P-20260627-030509-peeking-panes-too-often-burns-co (Peeking panes too often burns context budget) -> PROBLEMS.md (filed 2026-06-27)
Evidence: New hermetic regression test (added, 6/6 pass)

Source: New hermetic regression test (added, 6/6 pass)

ok - propose-tool: appends the documented schema to CAPABILITIES.md and queues an evaluation
ok - report-problem: appends the documented schema (and TBD default) to PROBLEMS.md and queues an evaluation
ok - propose-tool: a colliding id is suffixed -N instead of overwriting
ok - fm-registry: a no-slug title gets the stable 'entry' id fallback
ok - fm-registry: missing flags, unknown subcommand, and unknown flags fail non-zero with a message
ok - fm-registry: a failed queue preflight leaves the tracked registry untouched

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ℹ️ bin/fm-registry.sh:101 - fm-registry.sh appends new entries to the end of the file (>> "$CAP" / >> "$PROB"), relying on "## Proposed tools" and "## Registry" each being the last section. The CAPABILITIES.md anchor marker ("propose-tool entries are appended below this line") is decorative - the script never seeks to it. If any section is ever added below these, generated entries will silently land in the wrong section. Consider inserting at the anchor marker (or asserting the target section is last) to make the contract robust.
  • ℹ️ bin/fm-registry.sh:142 - The help/usage output is produced by sed -n '13,15p' "$0", hard-coding the line range of the usage comment block. Editing the header comment shifts those lines and silently corrupts --help output. A heredoc usage() or matching the # Usage: anchor would be self-maintaining.
✅ **Test** - passed

✅ No issues found.

  • bash -n bin/fm-registry.sh and bin/fm-registry.sh --help (parse + usage)
  • End-to-end captain flow in a sandboxed FM_ROOT (copies of real registries): bin/fm-registry.sh propose-tool --tool ... --replaces ... --why ... --notes ... and bin/fm-registry.sh report-problem --problem ... --symptom ... --impact ... --cause ... --fix ... -> verified schema-exact entries appended to CAPABILITIES.md / PROBLEMS.md and pointer lines added to data/evaluation-queue.md
  • Robustness: id-collision suffixing (same-second dupe -> -2), slug fallback (??? 上海 !!! -> entry), omitted --fix -> TBD - to be evaluated, missing required flag / unknown subcommand / unknown flag all exit 1 with a message
  • Safety invariant: forced data/ creation failure (FM_DATA_OVERRIDE under a regular file) -> script exits 1 and the tracked registry is NOT mutated (no orphaned entry)
  • Programmatic label comparison: report-problem/propose-tool emitted **Field:** labels vs the schemas declared in PROBLEMS.md/CAPABILITIES.md headers (exact match; only optional Resolved omitted by design); skill doc relative links resolve to repo-root registries
  • Added and ran tests/fm-registry.test.sh (hermetic, matches existing tests/lib.sh convention, picked up by CI's tests/*.test.sh loop) - 6/6 cases pass
🔧 **Document** - 1 issue found → auto-fixed ✅
  • ℹ️ AGENTS.md:46 - AGENTS.md section 1's 'Shared, tracked material means ...' enumeration (line 46) and the section 2 layout tree both omit the two new tracked top-level files CAPABILITIES.md and PROBLEMS.md. Left unchanged because the change deliberately isolated its AGENTS.md edit to a single new section (14) for clean rebasing against a concurrent watcher fix; folding the two files into those enumerations is a judgment call about prioritizing accuracy over that isolation. The parallel list in CONTRIBUTING.md was updated since it carries no such constraint.

🔧 Fix: sync tracked-file lists with new registries
✅ Re-checked - no issues remain.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

- CAPABILITIES.md: living manifest of tools, MCPs, skills, gates, and known limits
- PROBLEMS.md: recurring-problem registry with explicit schema and status vocabulary
- propose-tool / report-problem captain skills, backed by bin/fm-registry.sh
- AGENTS.md section 14 points to the registries and both skills
- align PROBLEMS.md schema with helper/seed fields (Reported required, Resolved optional) instead of the Reported/Resolved mismatch
- make fm-registry.sh ids collision-free (-N suffix) with a non-empty slug fallback
- preflight the evaluation queue before mutating the tracked registry so a failed queue write never leaves an unqueued entry
@dominikbullo

Copy link
Copy Markdown

PLAN

Which table: the screenshot is the /flip list (Mac Mini M4 / iPad Pro rows, Comp estimate, Profit (p25-median), Sell-through, Risk, Action, Max bid, Owner columns). It predates #113's card layout; /flip rows are cards today but the owner's ask stands for every items table.

Approach — one page, one URL scheme: /l/{uid} (uid = site:site_id, shared by listings and flip_items, so one URL covers watchlist listing, flip item, or both).

  • New GET /items/{uid} (JSON) composes the existing per-kind payloads (listing + history stats from GET /listings/{uid}, flip row + seller + shadow bid + worst-case from GET /flip-items/{uid}; both handlers keep their routes, their bodies are extracted into shared builders) and adds what no page showed before: verdict ledger (flip_verdicts), Tradera bids (flip_auction_bids + flip_bidders), fetch history (fetch_records for the item URL and its bid-history URL), 3rd-party request log rows for the same URLs, the item's /events lines (message contains the uid), evaluations (writer_jobs kind=evaluate, dedupe_key=uid), seller link + other-listings count. Comps chart reuses GET /flip-items/{uid}/comps (lazy).
  • /l/{uid} page becomes the unified page (existing Fira/dashboard style): hero + actions for each kind, decision + reasons + risk, price/estimate/bids chart, comp chart with matched product key, seller, bids, fetch history, request log, events, evaluations, raw fields. Every table uses the shared createTableToolkit (client mode, URL-synced sort/page state per table).
  • Removed (clean cutover, no alias): /flip/item/{uid} page + _FLIP_ITEM_DETAIL_PAGE; its link sites repointed to /l/{uid}.
  • Links from every item row: dashboard table/cards (existing chart icon -> "Details"), dashboard phone peek sheet (new Details button), /flip card title, /evaluations row (done jobs, inside the existing actions cell), evaluation result panel, seller page listings table (inside the title cell). No new table columns anywhere. /market, /trends, /profit rows are products/weeks, not items; /requests rows carry no uid — listed in docs/ inventory as not item tables.
  • Store: new read-only queries in DealStore (item_fetch_records, item_request_log, item_events, item_bids, writer_jobs_by_dedupe_key, flip_verdicts_for_uid).

Files: app/api/main.py, app/store.py, tests (tests/test_api.py, tests/test_flip_api.py, tests/test_flip_page_browser.py, tests/test_store.py), README line, docs note.

Proof: pytest for the new payload + store queries + link wiring; then a SQLite copy of the live DB shape (read-only export of one flip item and one watchlist item with all their related rows from the live Postgres), serve the app against it, screenshots of /l/{flip uid} and /l/{watch uid} via chrome-devtools-axi, plus screenshots of the links from /flip and /.

Observability: no new write path or collection; the existing HTTP middleware metric already labels by route template, so /items/{uid} shows up as its own series. No new metrics/events.

Out of scope: new scrapers, pricing logic, new data collection, notifier deep links (still /flip?uid=).

@dominikbullo

Copy link
Copy Markdown

PR

https://github.com/dominikbullo/deals/pull/119 (ready for review, not a draft)

One unified item page at /l/{uid} backed by a new read-only GET /items/{uid}: watchlist listing and/or flip candidate (they share the site:site_id uid), price history, verdict ledger, Tradera bids, fetch history, request log, /events lines, evaluations, comps chart with the matched product key. /flip/item/{uid} is removed; every items table links to /l/{uid} (dashboard table/cards/phone peek, /flip cards, /evaluations rows, evaluation result, seller-page listings) with no new columns.

Deviations from PLAN:

  • Fixed a pre-existing bug on the seller page (SEK never defined, so /s/{site}/{id} threw before drawing its listings table, live too) — the link I add to that table could not exist otherwise. Browser-test covered.
  • Item events are matched as whole identifiers (tradera:77 is not tradera:770), filtered in Python over the SQL LIKE candidates.
  • Flip cost/bid figures on the new page (expected final, shadow bid, verdict-history cells) route through the caveat helper; docs/fee-caveat-inventory.md lists every figure.
  • Wide tables scroll inside their panel (first draft overflowed a 390px phone to 540px).

@dominikbullo

Copy link
Copy Markdown

VERIFY

Tests (uv run pytest): 792 passed, 10 skipped (the skips are the Postgres-only tests); ruff check app tests: all checks passed. New: tests/test_item_detail.py (payload carries every section; item 77 does not collect item 770's fetches/requests/events; LIKE wildcards in a uid match literally; watch-only / flip-only / both; 404; fetch "changed" semantics) and real-Chromium tests in tests/test_flip_page_browser.py (flip row title → /l/… with every section rendered and no page errors; Interesting round-trip; 404 message; seller page renders with a link to /l/…; 390px phone has no horizontal overflow).

Page against the live shape. The agent has no DB access (pods/exec, port-forward, secrets forbidden to the read-only SA), so I built a SQLite copy from read-only GETs of https://deals.bullo.se (script + raw JSON kept under the task data dir) and ran the branch against it (DB_DIR=… uvicorn app.api.main:app):

  • Real live rows: flip item tradera:752921381 (iPhone 14 Pro auction, BID, n=50 comps, 20 bids, 5 price changes, seller maheeee, shadow bid), its 51 matched comps, watchlist item tradera:752776976 (Thule roof rack, 2 price changes, seller Etervåg) with its 19 real request-log rows, the seller profiles.
  • Synthetic, live-schema rows (the public API does not expose these tables): the flip item's 14 bids + 4 bidders, 3 verdict-ledger rows, 17 fetch records, and one done evaluation job. The watch item has no fetch history for the same reason, and the flip item has no request-log/events rows (none logged live for it) — both show their empty states.

Flip item (BID auction; comps chart + table, bids on the curve, verdict history, bids, fetch history):
flip item

Watchlist item (budget/fair lines, valuation, 19 request-log rows):
watch item

Phone, 390px (no horizontal overflow; before the fix scrollWidth was 540 vs 375):
phone

Links from the item tables: /flip card (title → /l/…), /evaluations row ("details" in the actions cell), seller page (title cell; this page was broken before — console Uncaught (in promise), "Loading…" forever — and renders after the SEK fix), dashboard (Details icon → /l/tradera%3A752776976; it already existed, now labelled "Details", plus a new Details button in the phone peek sheet).

Not verified: the deployed page on live data (firstmate's live check); Postgres dialect of the new queries (they use only ? binds, LIKE … ESCAPE '!', IN, LEFT JOIN, scalar sub-selects, same constructs the repo already runs on both); the phone peek-sheet Details button was only exercised through the existing dashboard code path, not tapped in a browser.

@dominikbullo

Copy link
Copy Markdown

BLOCKED

CI on https://github.com/dominikbullo/deals/pull/119 is red for an infrastructure reason, not a code one: both attempts (original + rerun, run 37370412317) were cancelled after 15m with no steps executed — check-run annotation: "The job was not acquired by Runner of type hosted even after multiple attempts". githubstatus.com reports "Actions: major_outage — Incident with Actions investigating". There is no failing log to fix.

What I verified instead, on the PR head c5a19e4 with a local postgres:16-alpine and TEST_POSTGRES_URL set exactly like .github/workflows/test.yaml: uv run pytest -q → 814 passed, 1 skipped (the 10 skips in my earlier VERIFY were this Postgres-gated set); ruff check app tests clean; the new GET /items/{uid} payload checks (events whole-identifier match, LIKE-escape, fetch changed, seller count) also pass against Postgres, which closes the "Postgres dialect not verified" item in VERIFY.

Needs: a rerun of the test workflow once the Actions incident clears (gh run rerun 37370412317). No code change is pending.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
…enguid#98)

The captain often opens the phone page just for those utilities, so they need to sit above the fleet glance.

Co-authored-by: Cursor <cursoragent@cursor.com>
@eait1200

eait1200 commented Nov 3, 2026

Copy link
Copy Markdown

Update, commit 16fdc017:

  • Security-review fixes:
    • The root-run health attribute checks that the whole path is root-owned and pins the vendor signature (Microsoft UBF8T346G9, NetBird TA739QLA7A) before executing mdatp or netbird.
    • wdav.pkg is verified from a private copy: exit code, the Status line, and an exact first chain entry. It must also pass Gatekeeper, and that same copy is the one uploaded.
    • rollback --unscope also disables and unscopes the uninstall policy, and stage refuses while a rollback is in effect until rearm is run.
  • Captain decision: macOS 14+ is eligible, with a warning on 14 because Microsoft supports only 15, 26 and 27. The pilot must be a macOS 15 or 26 Mac. Macs on 13 are listed in preflight with their users, and no OS is upgraded.
  • Vault: references/key-vault/admin-manifest.json now has JAMF_URL, JAMF_CLIENT_ID and JAMF_CLIENT_SECRET, delivered by kv-exec (limited API client only).
  • Tests: 13 MDE tests pass, and the 30 existing admin-secrets tests still pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants