Skip to content

feat(config): add {file:...} interpolation to agent markdown prompts - #38379

Closed
daryltucker wants to merge 1 commit into
anomalyco:devfrom
daryltucker:pr/file-interpolation
Closed

daryltucker wants to merge 1 commit into
anomalyco:devfrom
daryltucker:pr/file-interpolation

Conversation

@daryltucker

@daryltucker daryltucker commented Jul 22, 2026

Copy link
Copy Markdown

Issue for this PR

Closes # (no issue — feat PR is exempt from issue requirement per check-standards logic)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Support {file:path} syntax in agent markdown config files to include external file contents at load time. File paths resolve relative to the referencing file; absolute paths and ~ expansion also work.

This was originally implemented in the feat/file-interpolation branch (commit f34366bec7) and has been cleaned up, rebased onto dev, and scoped to only the interpolation feature for this PR.

Before: agent and mode prompt fields could only contain literal markdown text. Referencing external content required duplication or separate loading logic.

After: {file:./path/to/file.md} references are resolved at config load time — frontmatter is stripped, circular references and max depth (5) are detected, and errors are reported via HTML comment placeholders + console.warn() without crashing the load.

How did you verify your code works?

  • bun test config/ — 194 passed, 3 skipped (pre-existing), 0 failed
  • bun typecheck from packages/opencode — clean
  • 11 new test cases in interpolate-files.test.ts covering: simple refs, missing files, frontmatter stripping, relative paths, circular references, max depth, same-file branches, recursive inclusion, empty files, multiple distinct refs

Screenshots / recordings

N/A — config/interpolation change, no UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #34964: feat(opencode): inject file in markdown agents

This PR appears to be addressing the same feature—injecting file contents into markdown agent prompts. It may be an earlier attempt or related work for the same functionality that PR #38379 is implementing with {file:...} interpolation syntax.

@daryltucker
daryltucker force-pushed the pr/file-interpolation branch from 6f66a91 to 9b0350a Compare July 22, 2026 20:36
@daryltucker

Copy link
Copy Markdown
Author

Tested this for a few weeks and everything seemed to work nicely.
Came back after short vacation, and OpenCode was pretty broken... found the leak issue.
Pulled in the Leak fix, as well as enhancements for architecture changes, and continuing testing.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@daryltucker
daryltucker force-pushed the pr/file-interpolation branch from bf31230 to c869a8a Compare August 16, 2026 05:58
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant