Skip to content

Replace 'App:' prompt prefix with natural-language phrasing#333

Merged
FuJacob merged 1 commit into
mainfrom
fix/prompt-app-prefix
May 28, 2026
Merged

Replace 'App:' prompt prefix with natural-language phrasing#333
FuJacob merged 1 commit into
mainfrom
fix/prompt-app-prefix

Conversation

@FuJacob
Copy link
Copy Markdown
Owner

@FuJacob FuJacob commented May 28, 2026

Summary

The 'App: ' label in the screen-context block was leaking into model outputs, with completions occasionally emitting 'App: ...' as if it were continuation text. Rewriting it as 'User is on .' keeps the signal but removes the label-style cue that encourages the bad pattern.

Validation

  • xcodebuild -project Cotabby.xcodeproj -scheme Cotabby -destination 'platform=macOS' build → ** BUILD SUCCEEDED **
  • swiftlint lint --quiet → exit 0
  • Updated PromptPolicyTests and LlamaPromptRendererTests to match the new phrasing.

Linked issues

None.

Risk / rollout notes

Prompt-only change. Affects both the llama.cpp and Foundation Models renderers, so suggestion phrasing may shift slightly even for completions that previously behaved well.

Greptile Summary

This PR replaces the label-style App: <name> line in the screen-context block with the natural-language sentence User is on <name>. across both the llama.cpp and Foundation Models prompt renderers, addressing a model-output artifact where the old key-value phrasing occasionally leaked into completions.

  • Both LlamaPromptRenderer and FoundationModelPromptRenderer receive the identical one-line wording change, keeping the two engines in sync.
  • Tests in LlamaPromptRendererTests and PromptPolicyTests are updated to assert the new string, preserving full deterministic coverage of the prompt-rendering contract.

Confidence Score: 5/5

Prompt-only, two-line change with no logic modifications; safe to merge.

The change is purely textual — one string literal replaced consistently in both renderers and both test files. No control flow, data model, or API surface is touched, and the existing deterministic tests continue to cover the exact output contract.

No files require special attention.

Important Files Changed

Filename Overview
Cotabby/Support/FoundationModelPromptRenderer.swift Single-line prompt wording change: App: <name>User is on <name>. in the screen-context block of the request prompt.
Cotabby/Support/LlamaPromptRenderer.swift Identical single-line prompt wording change as the Foundation Models renderer, keeping both engines in sync.
CotabbyTests/LlamaPromptRendererTests.swift Test assertion updated from App: Slack to User is on Slack. to match the new renderer output; no other test logic changed.
CotabbyTests/PromptPolicyTests.swift Test assertion updated from App: TestApp to User is on TestApp. to match the new Foundation Models renderer output; no other test logic changed.

Sequence Diagram

sequenceDiagram
    participant SC as SuggestionCoordinator
    participant LPR as LlamaPromptRenderer
    participant FMPR as FoundationModelPromptRenderer
    participant M as Model (llama / Foundation)

    SC->>LPR: prompt(prefixText, applicationName, ...)
    LPR-->>SC: "Screen context:\nUser is on <name>.\n..."
    SC->>M: infer(prompt)

    SC->>FMPR: prompt(for: request)
    FMPR-->>SC: "Screen context:\nUser is on <name>.\n..."
    SC->>M: generate(instructions, prompt)
Loading

Reviews (1): Last reviewed commit: "Replace 'App:' prompt prefix with natura..." | Re-trigger Greptile

The 'App: <name>' label in the screen context section was leaking into
model outputs, with completions occasionally echoing 'App: ...' as if it
were continuation text. Rewriting it as 'User is on <name>.' removes the
label-style cue without losing the signal.
@FuJacob FuJacob merged commit e94309c into main May 28, 2026
4 checks passed
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