Repository navigation
fix(init): align agent templates with csp output and auto-cache - #122
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes manual indexing instructions and references to the --index option across multiple README files, agent templates, and documentation, replacing them with details on automatic caching and indexing. It also standardizes the parameter name from filePath to file_path and adds a Rust test to verify that agent templates align with these updates. Feedback on the changes suggests translating the newly added English inline comments in the Korean README (README.ko.md) to Korean to maintain language consistency.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 16 files
Linked issue analysis
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Use file_path across templates and plugin copies | The templates and both plugin copies use file_path, and the new test checks every bundled Agent template. |
| ✅ | Describe automatic caching without requiring pre-indexing | The updated guidance describes automatic caching and removes the instruction to run csp index -o first. |
| ✅ | Use --max-snippet-lines 10 in the examples | The first search example in the updated templates, plugin copies, and documentation uses --max-snippet-lines 10. |
| ✅ | Update both READMEs together | README.md and README.ko.md both replace the old indexing advice with automatic-cache guidance. |
| ✅ | Test that bundled templates contain no filePath | The new test iterates over every Agent template and fails if it contains filePath. |
Architecture diagram
sequenceDiagram
participant U as dev/LLM Agent
participant CLI as csp CLI
participant AC as Auto-Cache
participant IDX as Index Store
participant SR as Search Results
Note over U,SR: csp search - runtime flow
U->>CLI: csp search "query" ./my-project --max-snippet-lines 10
CLI->>AC: check/query cache (auto-cached)
alt Cache miss (first run or files changed)
AC->>IDX: Build index incrementally
IDX-->>AC: Index ready
AC->>AC: Store by content hash
end
AC-->>CLI: Cached results
CLI->>SR: Format results (snake_case keys)
SR-->>U: {file_path, line, snippet...}
Note over U,CLI: csp find-related - follows up on file_path + line
U->>CLI: csp find-related src/auth.ts 42 ./my-project
CLI->>SR: Resolve related chunks (uses existing auto-cache)
SR-->>U: Related code locations
Note over U,CLI: Agent workflow (per templates)
U->>CLI: Navigate directly to file_path:line
U->>CLI: (Occasionally) grep for exhaustive literal matches
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the documentation and agent templates across multiple files to reflect that indexing is now automatic and cached, replacing manual indexing commands. It also renames the line parameter to start_line for the find-related command and adds a unit test to verify these template changes. The feedback suggests enhancing the new unit test by asserting that the templates correctly contain start_line to ensure test integrity and prevent future drift.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
/gemini review |
|
There was a problem hiding this comment.
Code Review
This pull request updates documentation and agent templates across multiple markdown files to reflect the transition from manual indexing to automatic caching, standardizing references to 'file_path' and 'start_line'. It also adds a unit test in 'main.rs' to verify these template updates. The reviewer suggested extending this unit test to also validate sibling plugin templates when they exist in the local workspace, preventing future template drift and improving test coverage.



Summary
The agent instructions that
csp initwrites, and the copies the csp plugin ships, had drifted from csp's actual behavior and from upstream semble's current template. This PR brings them back in line.filePathfrom a prior search result. CLI/MCP output is the snake_case wire dict (utils::format_results), so the key isfile_path. camelCasefilePathis left unchanged in the library and SDK docs, where it is correct.csp index -oand said the index is not automatically updated. csp auto-caches under$HOME/.csp/index/and invalidates by content hash (ADR-0002). Following that advice pinned agents to a stale--indexcopy. The block is replaced with upstream's wording: "Results are cached automatically on first run and invalidated when files change."--max-snippet-lines 10, as upstream does (#198).Upstream's multi-repo paragraph is intentionally not included. csp does not support multi-repo search yet; that is tracked in #114.
Files
crates/csp/src/bin/csp/agents/*.md: all 10 templates. Bodies remain byte-identical and each file keeps its own frontmatter.plugins/csp/agents/csp-search.md,plugins/csp/skills/csp-search/SKILL.mdREADME.md,README.ko.md(kept in sync),docs/src/content/docs/agents-md.mdxcrates/csp/src/bin/csp/main.rs: new testagent_templates_match_cli_output_and_auto_cache. It asserts that everyAgenttemplate containsfile_pathand contains neitherfilePathnor the stale "not automatically updated" wording.The README reference sections that document the
csp indexcommand and the--indexflag are unchanged. Only the advice that agents must pre-index was removed.Related issue
Closes #111
Checklist
cargo test --workspace: 336 lib + 27 CLI tests pass)cargo fmtandclippy -D warningspass.bun run lintwas not run locally.Summary by cubic
Aligns the
csp initagent templates and plugin copies with csp's actual CLI output and its auto-caching behavior, fixing the two incorrect instructions from #111.file_pathandstart_linefrom search results instead of the nonexistentfilePath/line.csp index -opre-indexing step; templates now state results are cached automatically, with git URL indexes keyed by URL and--refrequiringcsp clear indexto refresh.--max-snippet-lines 10, and the workflow directs agents to navigate straight to the returnedfile_pathatstart_lineinstead of re-searching.file_pathandstart_lineand omitsfilePathand the stale "not automatically updated" wording.Written for commit e141657. Summary will update on new commits.