feat: add claude-native prompt format support with frontmatter stripping#134
Merged
Conversation
…tection
**Added:**
- `stripPromptFrontmatter` function that detects and strips YAML frontmatter from prompt files, enabling support for Claude Code's native dual-host prompt file format - `agent/bundle.go`
- Early-return path in `loadAndProcessPrompts` that bypasses all Go template rendering when a frontmatter block is detected, preserving literal `{{...}}` syntax (e.g. Taskfile examples) verbatim in system, wrapper, and task prompts
- Comprehensive test suite in `agent/frontmatter_test.go` covering frontmatter stripping edge cases (CRLF fences, unterminated blocks, mid-document horizontal rules), Claude-native mode (no template rendering, frontmatter dropped), and legacy template mode (Go template rendering still works as before)
**Changed:**
- Expanded doc comment on `loadAndProcessPrompts` to explain the Claude-native exception: frontmatter-marked entrypoints skip template rendering entirely, with mode still delivered via the `Mode:` header in `buildSystemMessage` - `agent/bundle.go`
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
**Changed:** - Switched `golangci-lint` installation from `curl | sh` to `go install` in both `pre-commit.yaml` and `renovate.yaml` workflows - `go install` verifies the binary via the Go module checksum database, eliminating the risk of transient checksum mismatches from the shell installer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Changes:
stripPromptFrontmatterto detect and remove YAML frontmatter from Claude-native prompt files, preventing template rendering for those agents{{...}}syntax survives verbatimcurl|shgolangci-lint installation withgo installin CI workflows for checksum-verified, reproducible buildsAdded:
stripPromptFrontmatterinagent/bundle.gohandles both LF and CRLF line endings, returns the body after the closing---fence and a boolean indicating detection; unterminated or mid-document fences fall back gracefullyloadAndProcessPrompts- when frontmatter is detected on the entrypoint, all three prompt files are returned raw without template execution, allowing prompt files to be shared verbatim with Claude Codeagent/frontmatter_test.gocovering frontmatter stripping edge cases (CRLF, unterminated, mid-document horizontal rules), Claude-native mode end-to-end, and legacy template rendering regressionChanged:
.github/workflows/pre-commit.yamland.github/workflows/renovate.yaml- replacedcurl | shscript withgo install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4so the Go module checksum database verifies the binary instead of trusting a remote shell script