feat(jetbrains): intellij_read PSI code intelligence tool#12114
Draft
kirillk wants to merge 3 commits into
Draft
feat(jetbrains): intellij_read PSI code intelligence tool#12114kirillk wants to merge 3 commits into
kirillk wants to merge 3 commits into
Conversation
When IntelliJ is still indexing or the file is not part of the imported project model, intellij_read now returns a status (indexing/unavailable) with a reason and instructs the agent to fall back to grep/glob/read instead of trusting an empty result as authoritative.
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.
What
Adds an experimental, JetBrains-only
intellij_readtool that lets the agent use IntelliJ's already-indexed PSI model for precise, type-aware navigation:goToDefinition,findReferences,goToImplementation,workspaceSymbol,documentSymbol, andtypeHierarchy.The tool is gated behind both
KILO_CLIENT === "jetbrains"and theexperimental.ide_code_intelligenceconfig flag.How it works
The CLI does no analysis itself.
intellij_readpublishes a request on the bus and awaits a reply; the JetBrains backend drains pending requests over HTTP (/kilocode/ide-lsp), runs PSI queries inside a read action, and posts a structured reply/reject. This mirrors the existing notebook-host pattern.Readiness & fallback (avoiding false negatives)
Code intelligence returns empty when IntelliJ isn't ready, which the agent would otherwise trust as an authoritative "no results". To prevent that, results now carry a
status(ready|indexing|unavailable) plus a human-readablereason:DumbService.isDumb/IndexNotReadyExceptionreportindexing.ProjectFileIndex.isInProject(file); if the file isn't part of the imported model, it returnsunavailableinstead of an empty result. This is a language-agnostic signal (no JVM-biased source-root/SDK heuristics).unavailable.When the status is not
ready, the tool tells the agent not to trust the empty result and to fall back togrep/glob/read(and thelsptool if enabled).Notes for reviewers
packages/kilo-jetbrains/package.json; these CLI/SDK changes require a newly published/pinned CLI release before the JetBrains plugin picks them up.workspaceSymbolis intentionally left ungated (it genuinely searches indexed content; gating risked false "unavailable").Testing
bun run typecheck,bun test ./test/kilocode/ide-lsp/service.test.ts(5 pass)./gradlew :backend:test --tests KiloCliDataParserTest(green; backend main sources compile)./script/generate.ts