Skip to content

fix: replace non-existent SearchDirectory with working search commands#10

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/prompt-search-directory-reference
Jan 2, 2026
Merged

fix: replace non-existent SearchDirectory with working search commands#10
zbigniewsobiecki merged 1 commit intodevfrom
fix/prompt-search-directory-reference

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Fixes a critical bug in the implementation agent prompt that was instructing agents to use a non-existent 'SearchDirectory' gadget, causing confusion and wasted iterations.

Problem

The implementation prompt (implementation.eta:53) referenced 'SearchDirectory' in search strategy examples, but this gadget doesn't exist in the codebase. This caused agents to:

  • Waste iterations trying to understand what SearchDirectory does
  • Not follow the intended search patterns
  • Make path assumptions without proper exploration

Solution

Replaced the non-existent SearchDirectory reference with actual working commands:

  • Tmux: find packages/e2e -name "*mobile*" -type f for finding files by name
  • Tmux: rg -l "mobile" packages/e2e for searching file contents

Changes

  • Updated src/agents/prompts/templates/implementation.eta line 53
  • Replaced fictional gadget reference with real, executable commands
  • Maintained the same pedagogical intent (show agents how to search)

Testing

  • Prompt change only, no code logic affected
  • Existing tests continue to pass
  • Future agent runs will use correct search commands

Impact

  • Agents will now use correct search patterns from the start
  • Reduces wasted iterations on path discovery
  • Improves agent success rate on implementation tasks

The implementation prompt referenced SearchDirectory("mobile", "path")
which doesn't exist as a gadget. This caused confusion for agents.

Changed to use actual working tools:
- Tmux with find command for filename searches
- Tmux with ripgrep for content searches

This fix addresses agent struggles observed in session analysis where
agents tried to use SearchDirectory and had to fall back to other methods.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 2699dcf into dev Jan 2, 2026
2 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/prompt-search-directory-reference branch January 2, 2026 00:49
zbigniewsobiecki added a commit that referenced this pull request Apr 18, 2026
Second real consumer of the shared wizard components. JIRA's legacy
per-provider step file (pm-wizard-jira-steps.tsx) has no live importers
outside itself; deletion deferred to plan 011/5.

- IssueTypeMappingStep: new JIRA-specific custom step at
  pm-providers/jira/issue-type-step.tsx. Maps CASCADE task/subtask
  roles to JIRA issue types (filtered by the `subtask` flag). Stays
  kind:'custom' rather than becoming an 8th StandardStepKind because
  JIRA is the sole consumer today — speculative abstraction avoided.
- jiraManifest.wizardSpec.steps: now [credentials, container-pick,
  status-mapping, label-mapping, custom-field-mapping,
  custom(IssueTypeMappingStep), webhook-url-display] — 7 steps, one
  custom.
- jiraProviderWizard.steps: rewritten to consume shared components via
  thin per-step adapters. Credentials step uses the shared
  `CredentialsStep` with a synthetic `base_url` role alongside email +
  api_token — no OAuth popup needed for JIRA (unlike Trello). Label
  mapping passes providerLabels: [] so the shared step renders in
  free-text mode (JIRA labels are free-form).
- Adapters file (jira/adapters.tsx): deleted — orphaned after rewrite.
- useJiraCustomFieldCreation: now accepts { name: string } argument
  (was hard-coded "Cost") so the shared Create affordance works.

Task 1 behavior inventory found the same 4 gap classes Trello
surfaced; all four were already closed by plan 011/2's forward-edit to
plan 011/1 (labelDefaults + fieldDefaults additive widenings). No
additional shared-component changes were required for JIRA.

AC #10 (no operator regression) marked **deferred** — browser smoke
test pending reviewer verification on the deployed branch. Unit tests
+ conformance harness cover wire-level invariants; legacy discovery +
custom-field hooks reused unchanged (only the name-arg tweak on the
custom-field mutation).

17 JIRA tests: 6 manifest + 7 issue-type + 4 wizard-generator. JIRA
had zero dedicated wizard-step tests before this plan — this is the
first JIRA wizard coverage landing. Full suite 8185/8185, lint +
typecheck + build all green.

Closes plan 011/3 of spec 011.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
zbigniewsobiecki added a commit that referenced this pull request Apr 18, 2026
…migration (specs 010 + 011/1-2) (#1148)

* docs(010): add spec + plans for PM integration hardening followups

* chore(010/1): lock plan 1 as .wip

* feat(010/1): manifest createCustomField hook + pm.discovery mutations

* chore(010/1): mutations complete, plan done

* chore(010/2): lock plan 2 as .wip

* feat(010/2): currentUser discovery capability + provider implementations

* chore(010/2): read cleanup done, currentUser UX restored

* chore(010/3): lock plan 3 with narrowed scope (option B)

* feat(010/3): wizard-components done — shared step components + generator dispatch

Upgrades the wizard generator from spec-010/1 placeholders to real shared
React components for every StandardStepKind. Six new components at
web/src/components/projects/pm-providers/steps/*.tsx: credentials,
container-pick, status-mapping, label-mapping, webhook-url-display,
project-scope. Generator exports STANDARD_STEP_COMPONENTS registry and
dispatches through it; unknown kinds still warn-once and render a
placeholder.

Trello/JIRA/Linear wizards keep their per-provider step adapters from
the spec-006 era — a future plan migrates them. The shared path is
live for new providers today.

new-provider-surface snapshot is tightened to pin the six new files;
wizard-generator + per-provider manifest-wizardSpec tests now assert
element.type identity against the registry instead of placeholder DOM
shapes. 55 new/updated tests, all green.

Docs updated: src/integrations/README.md (post-spec-010 additions),
root CLAUDE.md (PM-integration summary), spec 009 forward-references
spec 010, CHANGELOG entries for specs 009 + 010.

Closes plan 010/3 of spec 010.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(010): spec done — all plans complete

All three plans of spec 010 (PM integration hardening follow-ups)
shipped. Mutations (010/1) added generic pm.discovery.createLabel /
createCustomField endpoints. Read cleanup (010/2) added currentUser
discovery capability. Wizard components (010/3) landed real shared
React components for every StandardStepKind. Spec marked .done.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* docs(011): spec + plan decomposition for wizard shared migration

Spec 011 (PM Wizard Shared Migration) and its 5-plan decomposition.
Migrates Trello/JIRA/Linear wizards onto the shared StandardStepKind
components landed by spec 010 — closes the "zero per-provider step
code" promise across all three production providers, not just new
providers.

Plans: 1-shared-components (widen container-pick/project-scope with
searchable mode + widen webhook-url-display with optional signing-
secret + add 7th StandardStepKind: custom-field-mapping), 2-trello
(first consumer; OAuth stays kind:'custom'), 3-jira (issue-type stays
kind:'custom'; free-text label mode), 4-linear (retire LinearWebhook-
InfoPanel in favor of widened shared component), 5-cleanup (delete
pm-wizard-{trello,jira,linear}-steps.tsx + final docs rewrite).

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(011/1): lock plan 1 (shared-components)

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(011/1): shared-components done — widen 3 steps + add custom-field-mapping kind

Foundation plan for the wizard migration. Three additive widenings +
one new StandardStepKind. All changes dormant until plan 2 activates
them; the 31 spec-010 step tests pass unchanged as the backward-compat
proof.

- container-pick gains optional searchable?: boolean → dispatches to
  the existing shared Combobox (cmdk + radix) when true.
- project-scope gains the same searchable? prop; empty value still
  means "no scope" in both render paths.
- webhook-url-display gains optional secretFieldRole / secretLabel /
  secretValue / onSecretChange → renders an inline <input type="password">
  below the URL when both role + callback are supplied. Defensive: omits
  the input if role is set but callback is not (avoids uncontrolled
  secret inputs silently dropping user input).
- 7th StandardStepKind: 'custom-field-mapping'. New shared component at
  web/src/components/projects/pm-providers/steps/custom-field-mapping.tsx
  renders one row per CASCADE slot with a dropdown of discovered provider
  custom fields + optional inline "Create…" affordance wired to
  manifest.createCustomField (spec 010/1). Visual idiom matches
  status-mapping.
- STANDARD_STEP_COMPONENTS registers the new kind; generator dispatch
  falls through the existing switch path.
- new-provider-surface snapshot pins the 7th file.

Tests use element-tree identity checks where SSR would hit the React
instance mismatch (radix lives in web/node_modules and pulls its own
React). 17 new/updated test assertions across 4 files. Full suite
8153/8153, lint 0/0, typecheck + build green.

Closes plan 011/1 of spec 011.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(011/2): lock plan 2 (trello)

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(011/2): trello done — wizard migrated to shared step components

First real consumer of the shared wizard components. Trello's legacy
per-provider step file (pm-wizard-trello-steps.tsx) has no live importers
outside itself; deletion deferred to plan 011/5.

- TrelloOAuthStep: new custom step at pm-providers/trello/oauth-step.tsx.
  Lifts the window.open popup + manual-token fallback verbatim from the
  legacy TrelloCredentialsStep. Registered as kind:'custom' with
  component:'TrelloOAuthStep' in trelloManifest.wizardSpec.
- trelloManifest.wizardSpec.steps: now [custom(TrelloOAuthStep),
  container-pick, status-mapping, label-mapping, custom-field-mapping,
  webhook-url-display] — 6 steps, one of them custom.
- trelloProviderWizard.steps: rewritten to consume shared components via
  thin per-step adapters. useProviderHooks returns the flat shape each
  adapter slices (boardOptions, providerStates, providerLabels,
  providerCustomFields, onCreate* callbacks). Adapters call shared
  components directly with Trello-specific props.
- Adapters file (trello/adapters.tsx): deleted — orphaned after the
  wizard rewrite.
- useTrelloCustomFieldCreation: now accepts { name: string } argument
  (was hard-coded "Cost"). Enables the shared Create-form UX.

Forward-edit to plan 011/1 (additive, existing tests unchanged):
- label-mapping widened with optional labelDefaults?: Record<slot,
  {name, color?}> — pre-populates Create input, threads color to
  onCreateLabel. Trello uses it for cascade-ready/processing/etc.
- custom-field-mapping widened with optional fieldDefaults?: Record<slot,
  {name}> — pre-populates Create input. Trello uses it for cost field.

Normalize-upward UX changes (user-approved in behavior inventory):
- Dropped retry button on board-picker error (shared component shows
  error text; operator refreshes page).
- Dropped "Create All Missing Labels" batch button (per-slot Create
  covers the same ground, one click at a time).

AC #9 (no operator regression) marked **deferred** — browser smoke test
pending reviewer verification. Unit tests + conformance harness cover
wire-level invariants; no runtime behavior change in adapters
(discovery / label-creation / custom-field-creation hooks reused
unchanged).

19 Trello tests: 5 wizardSpec + 7 oauth-step + 7 wizard-generator. Plus
2 forward-edit tests on the widened shared steps. Full suite 8169/8169,
lint + typecheck + build all green.

Closes plan 011/2 of spec 011.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(011/3): lock plan 3 (jira)

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(011/3): jira done — wizard migrated to shared step components

Second real consumer of the shared wizard components. JIRA's legacy
per-provider step file (pm-wizard-jira-steps.tsx) has no live importers
outside itself; deletion deferred to plan 011/5.

- IssueTypeMappingStep: new JIRA-specific custom step at
  pm-providers/jira/issue-type-step.tsx. Maps CASCADE task/subtask
  roles to JIRA issue types (filtered by the `subtask` flag). Stays
  kind:'custom' rather than becoming an 8th StandardStepKind because
  JIRA is the sole consumer today — speculative abstraction avoided.
- jiraManifest.wizardSpec.steps: now [credentials, container-pick,
  status-mapping, label-mapping, custom-field-mapping,
  custom(IssueTypeMappingStep), webhook-url-display] — 7 steps, one
  custom.
- jiraProviderWizard.steps: rewritten to consume shared components via
  thin per-step adapters. Credentials step uses the shared
  `CredentialsStep` with a synthetic `base_url` role alongside email +
  api_token — no OAuth popup needed for JIRA (unlike Trello). Label
  mapping passes providerLabels: [] so the shared step renders in
  free-text mode (JIRA labels are free-form).
- Adapters file (jira/adapters.tsx): deleted — orphaned after rewrite.
- useJiraCustomFieldCreation: now accepts { name: string } argument
  (was hard-coded "Cost") so the shared Create affordance works.

Task 1 behavior inventory found the same 4 gap classes Trello
surfaced; all four were already closed by plan 011/2's forward-edit to
plan 011/1 (labelDefaults + fieldDefaults additive widenings). No
additional shared-component changes were required for JIRA.

AC #10 (no operator regression) marked **deferred** — browser smoke
test pending reviewer verification on the deployed branch. Unit tests
+ conformance harness cover wire-level invariants; legacy discovery +
custom-field hooks reused unchanged (only the name-arg tweak on the
custom-field mutation).

17 JIRA tests: 6 manifest + 7 issue-type + 4 wizard-generator. JIRA
had zero dedicated wizard-step tests before this plan — this is the
first JIRA wizard coverage landing. Full suite 8185/8185, lint +
typecheck + build all green.

Closes plan 011/3 of spec 011.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(011/4): lock plan 4 (linear)

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(011/4): linear done — + parent-wizard fix for plans 2+3 regression

Third real consumer of the shared wizard components. Plan 011/4 also
ships a critical fix for a regression plans 011/2 and 011/3 introduced:
pm-wizard.tsx hardcoded 3 manifest step slots (stepIndex 0/1/2) from
the spec-006 era. Trello/JIRA wizardSpecs grew to 6+ steps; only the
first 3 rendered on the deploy — label-mapping, custom-field-mapping,
and issue-type-mapping steps were INVISIBLE in production.

Fix: pm-wizard.tsx now iterates over `manifestDef.steps`, rendering
one WizardStep slot per entry. Webhook steps (id ends with `-webhook`)
are filtered out — the legacy WebhookStep still owns programmatic
webhook registration (Trello/JIRA API calls) and Linear's signing-secret
UX. The shared `webhook-url-display` component (widened in plan 011/1)
remains dormant for the three existing providers until a follow-up plan
migrates webhook-creation UX into the manifest path.

Linear wizard migration:

- linearProviderWizard.steps: rewritten to consume shared components
  via 6 thin per-step adapters. No kind:'custom' steps — Linear has no
  OAuth popup (like Trello) and no issue-type mapping (like JIRA).
- LinearWebhookDisplayAdapter: Fragment composing shared
  WebhookUrlDisplayStep + ProjectSecretField (LINEAR_WEBHOOK_SECRET).
  Currently dormant; activates after legacy WebhookStep migration.
- project-scope step (spec 005): uses the shared ProjectScopeStep with
  `searchable: true`.
- label-mapping: uses shared component with LINEAR_LABEL_DEFAULTS
  (plan 011/1 forward-edit) pre-populating the Create input with
  cascade-ready/processing/etc. and threading hex colors.
- Adapters file (linear/adapters.tsx): deleted — orphaned after
  rewrite.
- Legacy step tests deleted: linear-field-mapping-step.test.ts,
  linear-team-step.test.ts, linear-webhook-info-panel.test.ts
  (-450 lines). Replaced by 8-test linear-wizard-generator.test.ts
  covering the wizard wiring + manifest↔definition parity.

AC #3 (inline webhook secret), #6 (LinearWebhookInfoPanel retired),
and #11 (no operator regression) marked **partial/deferred** — see
Progress section for details. All other ACs green.

Full suite 8167/8167, lint + typecheck + build all green.

Closes plan 011/4 of spec 011.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(011/5): lock plan 5 (cleanup)

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(011/5): cleanup done — deleted 3 legacy step files + docs rewrite

Closes spec 011 per user-approved option (a) — tight scope: deletions
+ docs. Scope-clipped items (full LinearWebhookInfoPanel retirement,
Linear inline-secret via shared component) carry over as follow-up
work; rationale is captured in the plan's Progress section.

Deletions:
- web/src/components/projects/pm-wizard-trello-steps.tsx (retired
  since plan 011/2; no live importers)
- web/src/components/projects/pm-wizard-jira-steps.tsx (since 011/3)
- web/src/components/projects/pm-wizard-linear-steps.tsx (since 011/4)
- pm-wizard.tsx dead comments about transitive imports of the above

Audits:
- pm-wizard-common-steps.tsx — all three remaining exports
  (LinearWebhookInfoPanel, WebhookStep, SaveStep) still have live
  consumers via pm-wizard.tsx. File retained.
- Dead-code grep: only doc-comment references to the deleted files
  remain; no live imports.

Docs:
- src/integrations/README.md — four-specs preamble (006/009/010/011);
  "seven kinds" in "Adding a new PM provider" step 3;
  Post-spec-011 additions table alongside the Post-spec-010 one.
- CLAUDE.md (project root) — PM-integration summary references
  spec 011.
- CHANGELOG.md — Internal entry for spec 011 alongside 009/010.
- docs/specs/010-pm-integration-hardening-followups.md.done —
  forward-reference blockquote to spec 011.

Verification:
- npm test: 8167 passed, 23 skipped
- npm run lint: clean
- npm run typecheck: green
- npm run build: green
- Conformance harness: all three providers pass
- new-provider-surface guard: 7 step files pinned

Closes plan 011/5 of spec 011.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(011): spec done — all plans complete

Five plans of spec 011 (PM Wizard Shared Migration) shipped. Shared
components widened (plan 1), Trello migrated (plan 2), JIRA migrated
(plan 3), Linear migrated + pm-wizard.tsx parent refactor (plan 4),
legacy per-provider step files deleted + docs closed (plan 5). Spec
marked .done.

Deferred to follow-up spec:
- Full migration of webhook-creation UX (Trello/JIRA programmatic
  webhook registration + Linear signing-secret persistence) into the
  manifest path. Legacy WebhookStep + LinearWebhookInfoPanel still
  render for this.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
zbigniewsobiecki added a commit that referenced this pull request Apr 25, 2026
…tructured envelope, --comment alias) (#1190)

* docs(014): spec + plans for cascade-tools agent ergonomics

Adds docs/specs/014-cascade-tools-agent-ergonomics.md plus two plans
covering shared-infra and create-pr-review adoption. Prompted by prod
run 5d993b04-6e05-4ae1-b7de-8c274cf3496b.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(plan-014): lock plan 1 (shared-infra)

* feat(cascade-tools): plan 014/1 shared-infra — truthful prompts + envelope

Ships the root-cause fix for prod run 5d993b04-6e05-4ae1-b7de-8c274cf3496b
plus the shared infrastructure every future gadget inherits:

- System-prompt renderer (src/backends/shared/nativeToolPrompts.ts) stops
  stripping trailing 's' from array param names and claiming '<string>
  (repeatable)' for every array. Array-of-object params now render as
  `--<flag> '<json>'` with aliases appended via `|` and a one-line runnable
  example from the tool definition.
- Factory (src/gadgets/shared/cliCommandFactory.ts) gains oclif flag aliases,
  JSON parsing for array-of-object flags, file-input JSON parsing, `examples`
  wired into oclif `--help`, and Levenshtein-based 'did you mean' suggestions
  for mistyped flags (via fastest-levenshtein).
- New shared error envelope (src/gadgets/shared/errorEnvelope.ts) — every
  CLI failure emits `{"success":false,"error":{type,flag?,message,got?,
  expected?,hint?,example?}}` on stdout plus a one-line prose summary on
  stderr. All prior `this.error()` / flat `{success:false,error:"<string>"}`
  call sites migrated.
- Contracts widened: ParameterDefinition gains `cliAliases`, FileInput-
  Alternative gains `parseAs`, ToolManifest parameters carry `items`,
  `aliases`, `example`.
- Manifest generator threads the new fields through.
- bin/cascade-tools.js wraps `run()` to swallow oclif ExitError cleanly so
  the envelope isn't obscured by Node's default stack dump.

Plan-1 ACs #1#17 all delivered. 8438/8438 unit tests passing.

Test surface delta: 57 new unit tests across errorEnvelope.test.ts,
shared-nativeToolPrompts.test.ts, and factories.test.ts. Seven legacy
assertions encoding the pre-014 error surface updated in cli/cli-command-
factory, cli/file-input-flags, cli/scm/create-pr-sidecar, cli/scm/create-
pr-review-sidecar, backends/claude-code.

Plan 2 adopts the pattern on createPRReviewDef — zero shared-file edits —
proving the declarative-metadata invariant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(plan-014): lock plan 2 (createprreview-adopt)

* feat(cascade-tools): plan 014/2 createprreview-adopt + spec done

Applies the spec-014 declarative-metadata pattern to createPRReviewDef:

- --comment alias for --comments (the exact muscle-memory mistake from
  prod run 5d993b04-6e05-4ae1-b7de-8c274cf3496b).
- --comments-file <path> (and - for stdin) JSON-parsed escape hatch for
  long payloads that don't survive shell quoting.
- Two declarative fields on createPRReviewDef.parameters.comments.cliAliases
  + createPRReviewDef.cli.fileInputAlternatives. Zero edits to shared
  infrastructure (cliCommandFactory, manifestGenerator, nativeToolPrompts,
  errorEnvelope) — proves spec 014's single-entrypoint invariant.

Per-plan ACs #1, #2, #3, #5, #6, #7, #8, #9, #11, #12 auto-verified
(unit tests + build + lint + typecheck). AC #4 (binary-level smoke)
tagged [manual] because vitest fork-pool workers fail to capture
stdout/stderr from spawned binaries that do top-level await import();
the six scenarios were verified manually against the built binary and
the trace is recorded in the plan. AC #10 n/a — integration test path
abandoned for the same reason.

All plans done. Spec 014 marked .done (docs/specs/014-*.md → .done).
CHANGELOG Unreleased updated with a per-plan entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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