fix: use agent name not path in Copilot CLI --agent flag (#141)

* Scribe: Archive team sync — merge decisions inbox, trim Leela history - Merged 4 inbox decision files into .squad/decisions.md (Farnsworth: correlations/divergence/no-ai narratives; Leela: CI self-learning pipeline) - Cleared .squad/decisions/inbox/ (deleted leela-ci-self-learning.md; others not tracked) - Trimmed .squad/agents/leela/history.md from 15.9KB to 3.2KB (archived to history-archive.md) - Updated both agent histories with team sync completion record - Scribe tasks: PRE-CHECK (31.4KB decisions), ARCHIVE (none older than 30d), INBOX (4 files merged), LOG written, CROSS-AGENT appended, SUMMARIZATION executed Measured outcomes: - Before: decisions.md 31436B, inbox 4 files, Leela history 15927B - After: decisions.md (merged), inbox 0 files, Leela history 3183B, archive created - All squad/ changes staged and clean for commit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: use agent name not path in --agent flag The Copilot CLI --agent flag takes the agent name from YAML frontmatter, not a file path. Changed from '.github/agents/farnsworth.agent.md' to 'Farnsworth' in both the analysis and reskill jobs. Also simplified the -p prompts since the agent file already contains full identity and instructions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Juan Manuel Servera committed May 19, 2026 at 23:27 UTC 896066b7bb471c0fc4d0c40524314f57ffa3775b
5 files changed +240 -149
.github/workflows/crawl-and-publish.yml
+4 -4
@@ -300,8 +300,8 @@ jobs:
300 fi
301
302 if command -v copilot >/dev/null 2>&1 && copilot \
303 - --agent .github/agents/farnsworth.agent.md \
304 - -p "Read the file at ${PROMPT_FILE} — it contains your full analysis instructions and weekly GitHub data. Follow those instructions exactly. Output the final markdown analysis to ${OUTPUT_FILE}. After writing the analysis, append your learnings to .squad/agents/farnsworth/history.md under the Learnings section." \
303 + --agent Farnsworth \
304 + -p "Read the file at ${PROMPT_FILE} — it contains the weekly data and analysis instructions. Follow them exactly and write the analysis to ${OUTPUT_FILE}." \
305 -s \
306 --no-ask-user \
307 --model claude-sonnet-4 \
@@ -743,8 +743,8 @@ jobs:
743 python3 scripts/reskill.py --current-datetime "$CURRENT_DATETIME" --output "$RESKILL_OUTPUT" --prompt-output "$RESKILL_PROMPT" --print-prompt > "$RESKILL_PROMPT" || true
744
745 if command -v copilot >/dev/null 2>&1 && copilot \
746 - --agent .github/agents/farnsworth.agent.md \
747 - -p "Read the file at ${RESKILL_PROMPT} — it contains your full reskill retrospective instructions and context. Follow those instructions exactly. Write the reskill report to ${RESKILL_OUTPUT}. After writing the report, update .squad/identity/wisdom.md based on your Wisdom Updates section, and append learnings to .squad/agents/farnsworth/history.md." \
746 + --agent Farnsworth \
747 + -p "Read the file at ${RESKILL_PROMPT} — it contains the reskill retrospective instructions. Follow them exactly and write the report to ${RESKILL_OUTPUT}." \
748 -s \
749 --no-ask-user \
750 --model claude-sonnet-4 \
.squad/agents/farnsworth/history.md
+1
@@ -29,3 +29,4 @@
29 - **2026-05-19T20:50:22+02:00:** Press context dual-mode rendering implemented. Three reader-facing bugs fixed: (1) correlation list truncated to top-10 in reader mode (sorted by confidence desc, hype_risk severity); (2) `### Instructions` block stripped from reader output — it is AI prompt input only; (3) `#### Divergence Instructions` replaced with a plain narrative sentence for reader display. Architecture: `render_press_context.py` gained `reader_mode` kwarg propagated to `format_correlations_list(top_n=)` and `format_divergences(reader_mode=)`. `analyze_fallback._render_press_section_no_ai` now calls `_strip_ai_instructions()` which post-processes the pre-rendered file via regex — chosen because the fallback reads a file path, not raw JSON, so re-rendering from scratch would require threading data paths through. Key paths: `scripts/render_press_context.py`, `scripts/analyze_fallback.py`. 16 new tests added; 498 total pass.
30 - **2026-05-19T21:24:54+02:00:** Divergence reader-mode upgraded from bullet lists to narrative paragraphs. `format_divergences(reader_mode=True)` now calls `_format_unpublicized_narrative()` and `_format_uncovered_narrative()` — deterministic template-driven prose (no LLM), capped at top 6 topics (by star count) and 5 uncovered trends. Repo links use only the repo name part after `/` (e.g., `[wasm-lib](https://github.com/org/wasm-lib)`). AI-mode format (reader_mode=False) is unchanged. Key insight: for reader-facing output, the data shape matters less than telling a coherent story — aggregate by topic, link to repos by short name, conclude with interpretation. 499 tests pass.
31 - **2026-05-19T22:52:54+02:00:** Fixed two reader-mode polish issues and reskill 403 crash (PR #139). (1) Count header `N repos have press correlation:` stripped in reader_mode via `re.sub` — it was an AI-prompt artefact leaking into the published page. (2) `_extract_readme_description()` now trims every candidate line to the last sentence boundary (`.` `!` `?` followed by space or end); lines with no boundary are skipped entirely, so truncated snippets never produce half-sentences. The 150-char upper bound was removed — sentence trimming makes it redundant. (3) `reskill.py main()` now catches `RuntimeError` from `call_github_models()` and writes a placeholder report instead of crashing — the job exits 0 even when the configured model (`openai/gpt-4.1`) returns 403. Key lesson: template-rendered content always needs an explicit pass to strip AI-only fields when switching to reader mode — simply replacing the list with narrative paragraphs is not enough if the surrounding template text still contains prompt tokens. 519 tests pass.
32 +- **2026-05-19T20:57:55Z:** PR #139 merged. Correlation Summary section now renders as narrative prose in reader_mode (Decision recorded in `.squad/decisions.md`). Groups correlations by organization, ranks by aggregate confidence, fetches README snippets for top 2 repos per group (max 6 total), produces 1–3 interpretive paragraphs with inline links. Graceful failure on README timeout (5s). Key rationale: raw repo names with scores communicate data but not meaning; narrative format helps readers understand organizational impact. AI-mode output unchanged. Additionally: reskill job now catches RuntimeError on model 403, emits placeholder report, exits cleanly. Related decisions: `_format_correlations_narrative()` function pattern, README fetch timeout strategy, segment-by-org grouping logic. All new code covered by tests; 513 total pass.
.squad/agents/leela/history-archive.md new
+57
@@ -0,0 +1,57 @@
1 +# Leela — History Archive
2 +
3 +**Archive Date:** 2026-05-19T20:57:55Z
4 +**Reason:** history.md exceeded 15KB threshold
5 +
6 +## Summary
7 +
8 +Leela's Phase 0 work established core SquadScope architecture:
9 +
10 +- **PRD authored** (`docs/PRD.md`) with Hugo, Pagefind, RSS/Releases, plugin-pattern crawler, 5-run reskill cycle
11 +- **Architecture decision** (Issue #2) finalized Copilot CLI + GitHub Models fallback, analyzer contract (Markdown + YAML frontmatter + quality_score gate)
12 +- **Phase 0 completion** unblocked Phase 1 and Phase 2 work
13 +- **Phase 1 PR reviews** validated crawler hardening (PR #26), flagged analyzer contract mismatch (PR #25)
14 +- **Cost estimation PRD** (`docs/PRD-cost-estimation.md`) established sustainability baseline ($0.31/page annually)
15 +- **Topic Channels PRD** (`docs/PRD-topic-channels.md`, #39) designed multi-topic expansion with prediction ledger
16 +- **TechCrunch RSS PRD** (PR #55, revised by Bender) approved as Phase 0.8 cross-source intelligence foundation
17 +- **PRD decomposition** created 34 issues across v0.5–v0.9 milestones
18 +- **CI workflow refactored** (Issue #126) from direct main pushes to PR-based commits; ruleset bypass removed
19 +- **Learning cycle formalized** with wisdom/skills injection, prediction ledger, hindsight validation at N+4 weeks
20 +
21 +## Key Decisions
22 +
23 +- Hugo as static site generator (speed, maturity, RSS native support)
24 +- Copilot CLI primary + GitHub Models fallback
25 +- Weekly pages immutable, monthly/yearly append-only structure
26 +- Plugin architecture for multi-source crawling extensibility
27 +- Per-topic learning isolation (wisdom.md, skills/, predictions.jsonl per topic)
28 +- Cost-first philosophy: optimize token usage, enable monitoring framework
29 +
30 +## Resolved Open Questions
31 +
32 +- **OQ1/OQ3:** Copilot CLI in GitHub Actions (resolved in #2, CLI with fine-grained PAT approved)
33 +- **OQ2:** Hugo chosen over Astro (speed, simplicity)
34 +
35 +## Archived Entries
36 +
37 +**2026-05-18T12:07:20.778+02:00** — Phase 2 PR Review (PRs #27–28 blocker findings)
38 +**2026-05-18** — PRD Authoring
39 +**2026-05-18T10:06:38.734+02:00** — PRD Decomposition (24 issues organized by phase)
40 +**2026-05-18T10:11:20Z** — Decisions Merged (Copilot CLI, MCP crawling, Phase 0 gating)
41 +**2026-05-18T10:25:12.565+02:00** — CI Analysis Interface & Fallback Architecture (Issue #2 decision)
42 +**2026-05-18T10:27:35Z** — Phase 0 Completion (architecture merged, Phase 1/2 unblocked)
43 +**2026-05-18T13:20:07.067+02:00** — Topic Channels PRD
44 +**2026-05-18T10:59:10.800+02:00** — Phase 1 PR Review Gate
45 +**2026-05-19T05:17:53.102+02:00** — Cost Estimation PRD
46 +**2026-05-19T11:48:44.543Z** — PR #54 Merged (Cost Estimation approved)
47 +**2026-05-19T11:55:46.116Z** — PR #55 Review (TechCrunch RSS PRD rejected — empty branch)
48 +**2026-05-19T11:59:28Z** — PR #55 Resolved by Bender (TechCrunch RSS PRD rewritten)
49 +**2026-05-19T14:51:48.593+02:00** — PR #55 Re-review (approved after Bender revision)
50 +**2026-05-19T14:59:57+02:00** — PRD Decomposition into Milestones (v0.5–v0.9, 34 issues)
51 +**2026-05-19T18:05:10+02:00** — CI Workflow: PR-based commits, ruleset bypass reverted
52 +
53 +All findings integrated into `.squad/decisions.md` and issue backlog.
54 +
55 +---
56 +
57 +**Next Phase:** v0.5 cost visibility issues ready for implementation. Learnings from Phase 0 injected into agent wisdom. Self-learning loop activated by PR #140.
.squad/agents/leela/history.md
+8 -145
@@ -8,149 +8,6 @@
8
9 ## Learnings
10
11 -### 2026-05-18T12:07:20.778+02:00 — Phase 2 PR Review
12 -
13 -- **PR #27:** Not mergeable yet. The crawl workflow restores the `crawl-cache` artifact into repo root (`path: .`) while `scripts/crawl.py` reads cache from `data/cache/`, so the warm-cache handoff does not actually work yet.
14 -- **PR #28:** Not mergeable yet. The spec/prompt require the stable H2 heading `## Trending This Week`, but the sample analyzed artifact still uses `## Trending This Week (Stars Gained)`, so the example does not satisfy its own contract.
15 -- **GitHub constraint:** `gh pr review --request-changes` is blocked on self-authored PRs, so the blocking findings were recorded as PR comments instead.
16 -
17 -### 2026-05-18 — PRD Authoring
18 -
19 -- **PRD location:** `docs/PRD.md` — comprehensive PRD covering all requirements from jmservera
20 -- **Architecture decisions made:**
21 - - Hugo recommended as static site generator (speed, simplicity, native RSS)
22 - - Pagefind for client-side search (static, no server dependency)
23 - - RSS + GitHub Releases for MVP notifications (zero external dependencies)
24 - - Plugin pattern for future data source extensibility
25 - - Reskill every 5 runs via simple counter in `.squad/run-counter.txt`
26 -- **Key open questions flagged:**
27 - - How to invoke Copilot in GitHub Actions (OQ1, OQ3) — blocks Phase 2
28 - - Hugo vs Astro preference (OQ2) — awaiting stakeholder input
29 - - Star threshold for significance filtering (OQ4) — proposed 50 stars/week
30 -- **User preferences noted:**
31 - - jmservera wants full automation with zero manual intervention
32 - - "Nap and reskill" metaphor is important — deliberate self-improvement built into the system
33 - - Free-only notification options
34 - - Ever-growing archive — nothing deleted
35 -- **Content structure:** weekly (immutable) → monthly (append-only) → yearly (append-only)
36 -- **Data paths:** `data/raw/` (JSON), `data/analyzed/` (Markdown), `content/` (Hugo pages)
37 -
38 -### 2026-05-18T10:06:38.734+02:00 — PRD Decomposition
39 -
40 -- **Decomposition approach:** Split the PRD into tightly scoped, single-session GitHub issues organized by delivery phase and explicit handoffs between crawl, analyze, generate, notify, and reskill stages.
41 -- **Issue count:** 18 delivery issues + 6 governance/validation issues = 24 total issues.
42 -- **Phase structure:** Added a new **Phase 0: Investigation** in front of Foundation so OQ1/OQ3 (Copilot CLI in Actions + auth path) are resolved before automation work proceeds.
43 -- **Assignment pattern:** Mapped issues to roster strengths — Bender for Actions/crawler/integrations, Farnsworth for analysis/reskill logic, Amy for site/search/UX, Fry for validation, and Leela for architecture/docs.
44 -
45 -### 2026-05-18T10:11:20Z — Decisions Merged
46 -
47 -- **Copilot CLI:** Standalone CLI with fine-grained PAT (Copilot Requests) approved for Phase 0. Fallback: GitHub Models API.
48 -- **MCP crawling:** Multi-site crawling authorized; remote calls require allowlist in GitHub Copilot agent settings.
49 -- **Phase 0 gating:** OQ1/OQ3 investigation issues must close before Phase 2 analyzer work begins.
50 -- **Next:** Issue creation from scripts/create-issues.sh is ready for execution.
51 -
52 -### 2026-05-18T10:25:12.565+02:00 — CI Analysis Interface & Fallback Architecture (Issue #2)
53 -
54 -- **Architecture decision published:** `.squad/decisions/inbox/leela-ci-architecture-decision.md`
55 -- **Primary path:** Standalone `copilot` CLI with fine-grained PAT (`COPILOT_GH_TOKEN` secret → `COPILOT_GITHUB_TOKEN` env var). Programmatic mode with `--no-ask-user`, explicit `--allow-tool` flags.
56 -- **Fallback path:** GitHub Models API (`models.github.ai`) with built-in `GITHUB_TOKEN` and `permissions: models: read`. Triggered on CLI auth failure, quota exhaustion, or repeated errors.
57 -- **Pipeline contracts formalized:**
58 - - Crawl → Analyze: `data/raw/YYYY-WNN.json` (repo objects array)
59 - - Analyze → Generate: `data/analyzed/YYYY-WNN-summary.md` (Markdown + YAML frontmatter with `quality_score`)
60 - - Generate → Deploy: `public/` (Hugo build output)
61 -- **Reviewer gate:** quality_score ≥ 60, three required sections (Signal/Noise/Gaps), word count ≥ 200. Blocks publish on failure.
62 -- **Token strategy:** Fine-grained PAT with Account → Copilot Requests permission. Classic PATs not supported. Future spike: `GITHUB_TOKEN` + `copilot-requests: write`.
63 -- **MCP strategy:** Allowlist-gated remote calls, tool definitions in `.github/copilot/mcp.json`, crawl-stage only for external HTTP.
64 -- **Nap & reskill interface:** Every 5th run, Copilot CLI reads squad state and writes improvement recommendations to `.squad/reskill/YYYY-WNN.md`.
65 -- **Resolves:** OQ1 and OQ3 from PRD. Unblocks Phase 2 analyzer work.
66 -
67 -### 2026-05-18T10:27:35Z — Phase 0 Completion (Scribe)
68 -
69 -- **Status:** Phase 0 is complete. Architecture decision merged into `.squad/decisions.md`.
70 -- **Secret configured:** `COPILOT_GH_TOKEN` repo secret established (coordinator action).
71 -- **Issues closed:** #1 (completed by Bender) and #2 (Leela architecture).
72 -- **Team notification:** All agents notified that Phase 0 is complete and architecture is published.
73 -- **Next phase:** Phase 1 (crawlers and generators) can proceed independently. Phase 2 (analyzer) is unblocked.
74 -
75 -### 2026-05-18T13:20:07.067+02:00 — Topic Channels PRD
76 -
77 -- **Deliverable:** `docs/PRD-topic-channels.md` — feature PRD for topic-specific news channels
78 -- **PR:** #39 (squad/topic-channels-prd → main)
79 -- **Key decisions:**
80 - - Feature first, not separate platform — extends existing pipeline with topic namespace
81 - - v1 = single configurable topic per instance (fork per topic); v2 = multi-topic deferred
82 - - Per-topic learning isolation (wisdom, skills, predictions, scorecards)
83 - - New scoring pipeline between crawl and analyze (relevance score 0-100)
84 - - Prediction ledger (`predictions.jsonl`) with hindsight validation at week N+4
85 - - `squadscope.topic.yml` as the single config file controlling all topic behavior
86 - - Two example configs shipped: ai-ml and rust
87 -- **Rubber-duck findings addressed:** All 7 findings incorporated (namespacing, multi-instance, learning isolation, scoring pipeline, prediction ledger, channel structure, quality criteria)
88 -- **Learning audit gaps addressed:** G7 (prompt feedback), G8 (hindsight validation), G9 (prediction registry), G13 (enrichment signals as OQ5)
89 -- **Implementation plan:** 15 issues with dependency graph, ~7-9 sessions estimated
90 -
91 -### 2026-05-18T10:59:10.800+02:00 — Phase 1 PR Review Gate
92 -
93 -- **PR #26 outcome:** Acceptable and merged after validation. The hardened crawler delivered the expected Phase 1 improvements: caching, star snapshots, stronger low-signal filtering, bounded retry/rate-limit behavior, partial-failure metadata, and regression tests for the new query and payload behavior.
94 -- **PR #25 outcome:** I flagged a blocker against the dry-run artifact: the checked-in file under `data/analyzed/` does not match the approved Analyze → Generate contract in `.squad/decisions.md` (`Signal` / `Noise` / `Gaps`). By the time I verified final PR state, GitHub already showed PR #25 as merged, so the blocker was recorded as review commentary and follow-up guidance rather than an enforceable lockout.
95 -- **Operational constraint:** Because the authenticated GitHub account is also the PR author, GitHub blocked formal approve/request-changes reviews. Outcome had to be recorded by comment, and only PR #26 could be actively merged during this pass.
96 -
97 -### 2026-05-19T05:17:53.102+02:00 — Cost Estimation PRD
98 -
99 -- **Deliverable:** `docs/PRD-cost-estimation.md` — comprehensive PRD for token-based Copilot billing cost estimation and optimization
100 -- **Key findings:**
101 - - Weekly analysis cost: ~$0.30/run (Claude Sonnet 4, ~90K input tokens dominated by 301KB raw JSON)
102 - - Reskill cost: ~$0.036/run (GPT-4.1, much smaller context, runs every 5th week)
103 - - Annual all-in cost: ~$16/year for 52 weekly pages — $0.31/page
104 - - Context growth is modest (2-5%/year on weekly runs) because raw JSON dominates and is stable
105 - - Reskill grows faster (24-49%/year) due to accumulating history, but runs infrequently
106 -- **Optimization levers identified (ordered by ROI):**
107 - 1. Pre-process raw JSON to reduce tokens (40-60% savings on input)
108 - 2. Model downgrade for routine analysis (GPT-4.1 or Haiku saves 33-67%)
109 - 3. Prompt caching if available (77% savings on JSON portion)
110 - 4. Token budget with tiered degradation
111 -- **Pricing model hypothesis (pending OQ6 validation):** GitHub Models API and Copilot CLI are assumed to use the same per-token rates, with the difference being auth mechanism and agentic capabilities rather than cost per token. This assumption needs empirical validation — see PRD OQ6.
112 -- **Open risk:** Whether Copilot CLI transcript exposes actual token usage (needed for monitoring)
113 -
114 -### 2026-05-19T11:48:44.543Z — PR #54 Merged (Cost Estimation)
115 -
116 -- **Status:** All 4 review comments resolved and PR squash-merged to main
117 -- **Outcome:** Cost estimation framework approved for Phase A implementation
118 -- **Integration:** Cost tracking issues will be added to Phase A backlog
119 -- **Team note:** Cost analysis findings established sustainability baseline; no immediate budget action required but monitoring framework is essential for future growth planning
120 -
121 -### 2026-05-19T11:55:46.116Z — PR #55 Review (TechCrunch RSS PRD)
122 -
123 -- **Verdict:** REJECTED (request-changes, recorded as comment due to self-author constraint)
124 -- **Reason:** PR title/description promises a TechCrunch RSS integration PRD but the branch contains zero TechCrunch-related content. Actual diff is stale cost-estimation work already merged via PR #54. Branch has merge conflicts against main.
125 -- **Architectural observation:** The PR description's editorial framing (cross-source correlation to distinguish press hype from organic momentum) is sound and aligned with Decision #7's plugin architecture. When the actual PRD arrives, key review criteria will be: plugin interface compliance, overlap with topic-channels PRD, and incremental cost impact.
126 -- **Recurring pattern:** This is another instance of a PR being opened before the deliverable is committed — need team discipline on "commit first, then open PR."
127 -
128 -### 2026-05-19T11:59:28Z — PR #55 Resolved by Bender (TechCrunch RSS PRD Revision)
129 -
130 -- **Handoff:** Rejected PR #55 passed to Bender for revision (Farnsworth locked out per protocol)
131 -- **Outcome:** Bender rewrote PRD, rebased branch, committed deliverable, updated PR description
132 -- **Key decision captured:** TechCrunch as enrichment signal (5–15% correlation hit rate), not primary source
133 -- **Status:** PR #55 ready for next review cycle
134 -- **Team learning:** Rollback/rejection-to-revision cycle worked as designed — rejector (Leela) transitioned ownership cleanly, locked reviewer enabled handoff without conflicts
135 -
136 -### 2026-05-19T14:51:48.593+02:00 — PR #55 Re-review (TechCrunch RSS PRD)
137 -
138 -- **Verdict:** APPROVED (recorded as comment due to GitHub self-author constraint)
139 -- **Revision quality:** Excellent. Bender delivered a complete 443-line PRD that addresses all original rejection reasons.
140 -- **Key strengths:** Honest 5–15% correlation rate, graceful zero-noise degradation, Decision #7 plugin compliance, explicit failure criteria with removal triggers, phased rollout with exit gates.
141 -- **Minor suggestions (non-blocking):** Spike OQ1 (RSS content depth) before Phase 1; consider `correlate.py` placement at `scripts/` root since it's a cross-source concern; add URL-based dedup for mid-week article republishes.
142 -- **Pattern confirmed:** The reject → reassign → revise cycle works. Bender's revision was materially better than a "fix the branch" patch — it was a ground-up rewrite with proper editorial framing.
143 -- **Operational note:** GitHub still blocks formal approve/request-changes on self-authored PRs. Approval recorded via PR comment.
144 -
145 -### 2026-05-19T14:59:57+02:00 — PRD Decomposition into Milestones
146 -
147 -- **Milestone structure adopted:** v0.5 (Cost Visibility, 3 issues), v0.6 (Topic Channels Foundation, 6 issues), v0.7 (Learning & Predictions, 9 issues), v0.8 (Cross-Source Intelligence, 7 issues), v0.9 (Cost Optimization & Polish, 9 issues)
148 -- **Total issues created:** 34 issues across 5 milestones (issues #56–#89)
149 -- **PRDs processed:** 3 PRDs moved to docs/processed/ (cost-estimation, topic-channels, techcrunch-integration)
150 -- **Workflow change:** Milestone-based versioning adopted per user directive. PRDs → issues → milestones → docs/processed/
151 -- **Dependencies respected:** TechCrunch (v0.8) follows topic-channels foundation (v0.6); cost optimization (v0.9) follows cost visibility (v0.5)
152 -- **Label convention:** All issues carry `squad` + `squad:{agent}` labels for routing
153 -
11 ### 2026-05-19T18:05:10+02:00 — CI Workflow: PR-based commits, ruleset bypass reverted
12
13 - **Ruleset fix:** Removed RepositoryRole:5 bypass actor from the `main` ruleset (id 16532660). Branch protection must never be bypassed.
@@ -158,7 +15,7 @@
15 - **Steps renamed:** "Commit crawl data" → "Commit crawl data via PR", "Commit analysis" → "Commit analysis via PR", "Commit generated content" → "Commit generated content via PR", reskill step also converted.
16 - **No more `continue-on-error: true`** on commit steps — they succeed properly now via the PR path.
17 - **Tests updated:** Adjusted step name references in `tests/test_pipeline.py` to match new naming.
161 -- **Decision recorded:** `.squad/decisions/inbox/leela-no-ruleset-bypass.md`
18 +- **Decision recorded:** `.squad/decisions.md`
19
20 ### 2026-05-19T22:57:55+02:00 — CI Self-Learning Pipeline Architecture
21
@@ -169,6 +26,12 @@
26 - Reskill promoted to Copilot CLI primary path (was GitHub Models only); agent can now update wisdom.md directly
27 - Default model switched from `openai/gpt-4.1` (403) to `openai/gpt-4o` across all fallback paths
28 - **Key insight:** The learning loop requires three properties: (1) identity loaded before work, (2) state persisted after work, (3) persisted state injected into next run. The agent file provides (1), the commit step provides (2), and the existing prompt templates with `{{WISDOM}}`/`{{SKILLS}}` provide (3).
172 -- **Decision recorded:** `.squad/decisions/inbox/leela-ci-self-learning.md`
29 +- **Decision recorded:** `.squad/decisions.md`
30 - **Files modified:** `crawl-and-publish.yml` (analysis + reskill steps), `scripts/reskill.py`, `scripts/analyze_fallback.py`
31
32 +### 2026-05-19T20:57:55Z — Scribe Archival & Team Sync
33 +
34 +- **Scribe executed full archival cycle:** decisions.md merged 4 inbox files (Farnsworth correlations narrative, divergence narrative, no-AI re-render; Leela CI self-learning), cleared inbox, created orchestration logs for both agents, recorded session log, updated both agent histories.
35 +- **Decisions now in permanent log:** All three Farnsworth polish decisions + Leela self-learning architecture decision moved to `.squad/decisions.md` main document.
36 +- **Orchestration recorded:** `.squad/orchestration-log/2026-05-19T20:57:55Z-{farnsworth,leela}.md` — outcomes linked to PR #139 and #140.
37 +- **Status:** Team sync complete. Ready for next cycle.
.squad/decisions.md
+170
@@ -740,6 +740,176 @@ CI workflows must not push directly to protected branches. Use PR-based commits
740
741 ---
742
743 +
744 +# Decision: Divergence Section Uses Narrative Prose in Reader Mode
745 +
746 +**Date:** 2026-05-19T21:24:54+02:00
747 +**Author:** Farnsworth (Analyst)
748 +**Status:** Implemented
749 +**Affects:** `scripts/render_press_context.py`, `tests/test_render_press_context.py`
750 +
751 +## Decision
752 +
753 +The divergence section in `format_divergences()` now renders as narrative prose when `reader_mode=True`, replacing the prior bullet list format. AI-prompt mode (`reader_mode=False`) is unchanged.
754 +
755 +## Rationale
756 +
757 +Raw topic-and-repo bullet lists communicate data but not meaning. Readers gain more from a paragraph that groups activity, links to repos by short name, and closes with an interpretive sentence. The AI model still needs the full structured data — so the dual-mode architecture cleanly separates the two use cases.
758 +
759 +## Format Decisions
760 +
761 +1. **Repo links:** `[repo-name](https://github.com/owner/repo-name)` — repo name only (after `/`), never `owner/repo (⭐N)`.
762 +2. **Article links:** `[title](url)` — standard markdown.
763 +3. **Topic capping:** Top 6 topics by aggregate star count for "Dev Activity Without Press Coverage"; top 5 for "Tech Trends Without Dev Activity".
764 +4. **Structure:** Two named helpers — `_format_unpublicized_narrative()` and `_format_uncovered_narrative()` — keep the logic isolated and independently testable.
765 +
766 +## Implications
767 +
768 +- Any future changes to reader-mode divergence prose go into the two helper functions.
769 +- If the data schema adds new fields (e.g., `growth_rate`), the helpers can incorporate them without touching AI-mode output.
770 +- Tests updated: `test_reader_mode_has_narrative` and `test_reader_mode_has_repo_links` replace the old phrase-matching assertions. 499 tests pass.
771 +
772 +---
773 +
774 +# Decision: No-AI Fallback Must Re-render from Raw Data for Reader Mode
775 +
776 +**Date:** 2026-05-19T21:54:14+02:00
777 +**Author:** Farnsworth
778 +**Status:** Implemented (PR #137, merged)
779 +
780 +## Context
781 +
782 +The CI pipeline falls to the no-AI path when the AI API is unavailable. In that path, `_render_press_section_no_ai()` was reading the pre-rendered `data/analyzed/{WEEK}-press-context.md` and stripping AI instructions to produce reader output.
783 +
784 +The problem: that file is generated in AI-prompt mode (`reader_mode=False`). The narrative divergence format introduced in PR #136 is only produced when `reader_mode=True`. So the no-AI path always showed the old bullet-list format regardless of code changes in the reader-mode rendering path.
785 +
786 +## Decision
787 +
788 +**Re-render from raw JSON data in the no-AI path.** Specifically:
789 +
790 +1. Extract the week identifier from the `press_context_path` filename stem.
791 +2. Load `data/raw/{WEEK}-techcrunch.json` and `data/analyzed/{WEEK}-correlations.json`.
792 +3. Call `render_press_context(tc_data, corr_data, week, reader_mode=True)`.
793 +4. If raw files are absent, fall back to the existing strip-based approach.
794 +
795 +## Rationale
796 +
797 +- The pre-rendered press-context.md is an AI prompt artifact, not a reader artifact. It must not be the source of truth for reader-facing output.
798 +- Raw JSON files are always present when the CI pipeline runs (they are produced earlier in the same pipeline run).
799 +- The fallback ensures backward compatibility for edge cases (manual script invocations against older data).
800 +
801 +## Impact
802 +
803 +- The no-AI CI path now uses identical rendering logic to the AI path's fallback output.
804 +- Any future changes to `render_press_context(..., reader_mode=True)` automatically apply to the no-AI path without further changes.
805 +- The W21 page will show the correct narrative format on the next pipeline run.
806 +
807 +## Files Changed
808 +
809 +- `scripts/analyze_fallback.py` — `_render_press_section_no_ai()` (lines 346–370)
810 +
811 +---
812 +
813 +# Decision: Correlation Summary — Narrative Prose in reader_mode
814 +
815 +**Date:** 2026-05-19T22:34:57+02:00
816 +**Author:** Farnsworth (Analyst)
817 +**PR:** #138
818 +**Status:** Merged
819 +
820 +## Context
821 +
822 +The Correlation Summary section was showing a raw bullet list of repo names, confidence scores, and match types — useful for AI prompt consumption but meaningless to human readers. The Divergence section had already been upgraded to narrative prose (PR #131). This decision extends that pattern to correlations.
823 +
824 +## Decision
825 +
826 +When `reader_mode=True`, `format_correlations_list()` delegates to `_format_correlations_narrative()` which:
827 +
828 +1. **Groups correlations by org** (first path segment of owner/repo). This is the natural unit of press coverage — TechCrunch writes about organizations, not individual repos.
829 +2. **Ranks groups by aggregate confidence score** (sum of correlation_confidence across all repos in the group).
830 +3. **Fetches README snippets** (first 500 chars) for the top 2 repos per group, up to 6 total, using `urllib.request` with a 5-second timeout and graceful failure. This enables project descriptions in the narrative (e.g., "Guava is a set of core Java libraries from Google").
831 +4. **Produces 1–3 paragraphs** with inline links to repos (short name, e.g., `[codex](https://github.com/openai/codex)`) and matched TechCrunch articles (full title as link text).
832 +
833 +## Alternative Considered
834 +
835 +**No README fetching — use only repo names**: simpler and fully deterministic, but produces flat prose with no editorial context about what the repos actually do. The README fetch adds signal at low cost (max 6 network requests, fails gracefully).
836 +
837 +## Constraints Respected
838 +
839 +- `reader_mode=False` output is unchanged — AI prompt consumers still receive full raw data.
840 +- README fetching only happens in reader_mode=True paths (no side effects in CI pre-rendering).
841 +- Article title lookup reuses the already-loaded `tc_data["articles"]` list — no new I/O for the article side.
842 +- All new functions are covered by unit tests; 513 tests pass.
843 +
844 +---
845 +
846 +# Decision: CI Self-Learning Pipeline Architecture
847 +
848 +**Date:** 2026-05-19T22:57:55+02:00
849 +**Author:** Leela (Lead/Architect)
850 +**Status:** Proposed
851 +**Scope:** Analysis and reskill CI jobs — self-learning loop
852 +
853 +## Context
854 +
855 +The CI pipeline runs AI analysis (Copilot CLI) and reskill (GitHub Models API) but neither job leverages the squad agent system. The analysis agent has no identity, cannot read its own history/skills, and has no mechanism to write learnings back. The reskill job bypasses Copilot CLI entirely and uses a model (`openai/gpt-4.1`) that returns 403.
856 +
857 +## Decisions
858 +
859 +### 1. Dedicated Farnsworth Agent File (`.github/agents/farnsworth.agent.md`)
860 +
861 +A standalone agent file gives the Copilot CLI the full Farnsworth identity — charter, history reading instructions, post-analysis learning format, and write permissions to `.squad/`.
862 +
863 +**Rationale:** The `--agent` flag loads an agent markdown file with YAML frontmatter and instructions. A dedicated file allows CI-specific directives (learning output format, file write permissions) without polluting the interactive Squad coordinator agent.
864 +
865 +### 2. `--agent` Flag in Copilot CLI Invocations
866 +
867 +Both the analysis and reskill jobs now use:
868 +```bash
869 +copilot --agent .github/agents/farnsworth.agent.md ...
870 +```
871 +
872 +**Rationale:** This loads Farnsworth's identity, making the CLI aware of the agent's history, wisdom, skills, and learning expectations.
873 +
874 +### 3. Learning Commit Strategy: Same Branch, Same Job
875 +
876 +After analysis, `.squad/` changes (history, skills) are committed alongside `data/analyzed/` to the `publish` data branch in a single atomic commit.
877 +
878 +**Rationale:** No additional branch/PR overhead. The data branch is unprotected and already receives CI commits. Learnings are part of the analysis artifact — they should be co-located temporally. The reskill job already commits `.squad/` state via the same pattern.
879 +
880 +### 4. Model Fallback: `openai/gpt-4o` Replaces `openai/gpt-4.1`
881 +
882 +The default model for GitHub Models API fallback is changed from `openai/gpt-4.1` (which returns 403) to `openai/gpt-4o` (widely accessible).
883 +
884 +**Rationale:** `gpt-4.1` is not accessible via the GitHub Models API for this repository's token. `gpt-4o` is the current generally available model. The env var `GITHUB_MODELS_MODEL` still allows override.
885 +
886 +### 5. Reskill Primary Path: Copilot CLI with Agent
887 +
888 +The reskill job now tries Copilot CLI first (with agent identity), falling back to GitHub Models API if CLI is unavailable. This gives reskill the same agent-aware capabilities as analysis: read wisdom/skills/history, write updated wisdom and learnings back.
889 +
890 +**Rationale:** The reskill cycle is the primary mechanism for reinforcing the learning loop. With agent identity, it can directly update `wisdom.md` and `history.md` based on retrospective findings — the core of self-improvement.
891 +
892 +### 6. Prompt Template Unchanged
893 +
894 +The existing prompt templates (`prompts/analyze-weekly.md`, `prompts/reskill.md`) already inject wisdom and skills via `{{WISDOM}}` and `{{SKILLS}}` placeholders. The agent file complements this by providing identity context and learning output instructions that the templates alone cannot express.
895 +
896 +## Risks
897 +
898 +| Risk | Mitigation |
899 +|------|-----------|
900 +| Agent writes bad content to `.squad/` files | Quality gate still runs on analysis output; .squad changes are append-only learnings |
901 +| Copilot CLI doesn't support `--agent` as expected | Fallback path (GitHub Models via reskill.py) still works without agent identity |
902 +| Learning state diverges between publish branch and main | Periodic sync PRs already exist; learnings on publish are forward-compatible |
903 +
904 +## Implementation
905 +
906 +- [x] `.github/agents/farnsworth.agent.md` — agent identity file
907 +- [x] `.github/workflows/crawl-and-publish.yml` — `--agent` flag, learning commits, model fix
908 +- [x] `scripts/reskill.py` — model default updated to `openai/gpt-4o`
909 +- [x] `scripts/analyze_fallback.py` — model default updated to `openai/gpt-4o`
910 +
911 +---
912 +
913 ## Governance
914
915 - All meaningful changes require team consensus