Skip to content

refactor: single owners for knowledge/experience prompt blocks (plan 019)#90

Merged
DenysKuchma merged 2 commits into
mainfrom
refactor/prompt-context-consolidation
Jul 16, 2026
Merged

refactor: single owners for knowledge/experience prompt blocks (plan 019)#90
DenysKuchma merged 2 commits into
mainfrom
refactor/prompt-context-consolidation

Conversation

@DavertMik

Copy link
Copy Markdown
Contributor

Plan 019 — One owner for knowledge/experience prompt blocks

The "render relevant knowledge" and "render experience TOC" prompt blocks were re-implemented in 5 places with two different tag names (<knowledge> in the base class vs <hint> in Navigator/Researcher). This moves each to its owning tracker (per the CLAUDE.md Code Ownership Map):

  • KnowledgeTracker.renderRelevantKnowledge(state)
  • ExperienceTracker.renderExperienceTocFor(state)

Consumers now delegate:

  • TaskAgent.getKnowledge / getExperience → one-line delegations (kept for subclasses).
  • Navigator.resolveState + Navigator.verifyState knowledge/TOC blocks.
  • Researcher.buildResearchPrompt — also switches the knowledge source from the StateManager copy to explorer.getKnowledgeTracker() (already ${env.*}-interpolated via plan 010).
  • Pilot.getExperienceToc.

Tag unified on <knowledge> (Navigator/Researcher previously emitted <hint>). No prompt wording changed beyond the tag.

Drift reconciliation

This plan was written at 9e22b0d. Since then:

  • Step 2 (shared tracker instances) is already done in main — Navigator uses explorer.getKnowledgeTracker() / getStateManager().getExperienceTracker(), Captain uses explorBot.experienceTracker(). No new KnowledgeTracker()/new ExperienceTracker() remain in these files.
  • Step 3 (historian per-call new KnowledgeTracker()) — already gone from historian/.

Deferred

  • Step 4 (deletion-scope + stop-meta dedup) — deferred; touches tester/pilot/test-plan and is a separable concern.
  • Step 5 (Navigator.visitOnceExplorer.visit) — DEFERRED: behavioral (AI navigation would start honoring knowledge wait/waitForElement hints); wants its own review, as the plan's checkbox allows.

Verification

  • bun test tests/unit768 pass / 0 fail (+4 renderer tests).
  • bun test tests/integration/63 pass / 0 fail.
  • bun run lint → clean; tsc in touched files neutral vs main (21).
  • grep -rn "<hint>" src/ai/ → 0.
  • Tracker mocks in tester/researcher tests updated to expose the new render methods (documented test change — no <hint> assertions existed).

🤖 Generated with Claude Code

…019)

The "render relevant knowledge" and "render experience TOC" prompt blocks
were re-implemented in 5 places with two tag names (<knowledge> vs <hint>).
Move each to its owning tracker:
- KnowledgeTracker.renderRelevantKnowledge(state)
- ExperienceTracker.renderExperienceTocFor(state)

TaskAgent.getKnowledge/getExperience, Navigator (resolveState + verifyState),
Researcher.buildResearchPrompt, and Pilot.getExperienceToc now delegate.
Tag unified on <knowledge> (was <hint> in Navigator/Researcher). Researcher
now sources knowledge from the KnowledgeTracker (already env-interpolated via
plan 010) instead of the StateManager copy.

Steps 2 & 3 of the plan (shared tracker instances; historian per-call
KnowledgeTracker) are already satisfied in main by the DI cleanup + plan 010.
Steps 4 (deletion-scope dedup) and 5 (Navigator.visitOnce -> Explorer.visit,
behavioral) are deferred.

Adds unit tests for both renderers; updates the tracker mocks in tester/
researcher tests to expose the new render methods.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

Explorbot Self-Regression

Commit fb63ca8 · run

Scenario Result Attempts Duration
basic (native) PASS 1/3 7m
experience: control OK — failed as expected 1/1 2m
experience: seeded PASS 1/3 1m

Attempt details

  • basic (native) attempt 1 — PASS: login evidence: PASS (post-login plan=true, post-login research=true); research: PASS (files=6, wellFormed=true, keywords=7/3); scenarios: PASS (tests=5/5, features=4/3); tests passed: PASS (5 passed, 0 failed (reporter: 5 passed, 0 failed))
  • experience: control attempt 1 — PASS: control: OK — failed as expected (0 passed, 1 failed)
  • experience: seeded attempt 1 — PASS: seeded: PASS (1 passed, 0 failed)

Session analysis — basic (native):

Session Analysis

The Issues list page core functionality was validated: creating new issues, filtering by search/label/status, and opening issue details all work correctly. One test had a transient automation issue with modal field interaction but recovered successfully.

Coverage

  • Pages: /issues, /issues?new=1, /issues?q=API&status=, /issues?q=&status=closed, /issues?label=2, /issues/5
  • Features: Issue creation, search filtering, status filtering, label filtering, detail view navigation

What works

  • Issue creationET-1 Create a new issue via toolbar button and verify it appears in the list
  • Search filteringET-2 Filter issues by search term and verify results are narrowed
  • Status filteringET-3 Filter issues by status using the status combobox
  • Label filteringET-4 Filter issues by label using the label dropdown
  • Issue detail navigationET-5 Open issue detail view by clicking an issue title in the table

Execution Issues

  • ET-1 Create a new issue via toolbar button and verify it appears in the list — initial fillField failed on modal, recovered on second attempt and completed successfully

@DenysKuchma DenysKuchma left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge only after 92 and before 91

@DavertMik

Copy link
Copy Markdown
Contributor Author

@DenysKuchma please merge

@DenysKuchma
DenysKuchma merged commit 9037c52 into main Jul 16, 2026
3 checks passed
@DenysKuchma
DenysKuchma deleted the refactor/prompt-context-consolidation branch July 16, 2026 12:14
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.

2 participants