Skip to content

feat: wire lens into research prompts (closes R38) - #6

Merged
wikithoughts merged 1 commit into
mainfrom
feat/r38-lens-research-prompts
Aug 30, 2026
Merged

wikithoughts merged 1 commit into
mainfrom
feat/r38-lens-research-prompts

Conversation

@wikithoughts

Copy link
Copy Markdown
Owner

What

Closes backlog item R38 ("lens-axis") per docs/REVIEW_2026-07.md/docs/ROADMAP.md.

lens (an angle-of-attack instruction like skeptic/opportunity/first_principles/practical, injected as the first line of a model's prompt) has worked for chat jobs since council/worker.py's PerspectiveWorker.answer() — but was inert for research jobs: council/researcher.py's ResearchWorker.lens field existed and was threaded through, but nothing ever read it when building the findings-generation prompt.

This wires it in: ResearchWorker._draft() now computes LENSES.get(self.lens, LENSES["neutral"]) (same fallback pattern worker.py already uses) and injects it as the first instruction bullet, alongside the existing role/vantage/citation bullets. Query planning (_plan_queries/_refine_queries) is untouched — lens shapes only the final synthesis, matching worker.py's own scope (it doesn't lens the question either).

docs/GLOSSARY.md's Lens entry gets a one-clause addition noting this now applies uniformly across pw ask and pw research/network research jobs, since that's what the generic phrasing already implied.

Backward compatibility

council/local.py is intentionally untouched. It hardcodes lens="independent analyst" for single-player pw research — not a key in council.worker.LENSES — so LENSES.get(self.lens, LENSES["neutral"]) safely falls through to the neutral instruction for it, exactly as it already does for any other unknown lens string. This is verified by a dedicated regression test rather than "fixed" in local.py.

Testing

New tests/test_researcher_lens.py:

  • _draft()'s prompt carries LENSES["skeptic"]'s text when lens="skeptic".
  • _draft()'s prompt carries LENSES["neutral"]'s text with the default lens.
  • lens="independent analyst" (the exact string council/local.py hardcodes) does not raise and falls back to the neutral instruction text — the regression guarantee for local.py.

Full verification (all green):

  • python -m py_compile council/researcher.py tests/test_researcher_lens.py
  • ruff check . → All checks passed!
  • pytest tests/ -q → 510 passed, 1 skipped (511 collected total, including the 3 new tests; the 1 skip is pre-existing/unrelated)

Touched only council/researcher.py, tests/test_researcher_lens.py (new), docs/GLOSSARY.md — no changes to council/local.py, council/worker.py, or anything else.

🤖 Generated with Claude Code

@wikithoughts
wikithoughts merged commit 1207e78 into main Aug 30, 2026
6 of 9 checks passed
@wikithoughts
wikithoughts deleted the feat/r38-lens-research-prompts branch August 31, 2026 10:38
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.

1 participant