feat(#2884): ToolCapabilityExtractor — static capability classification#121
Merged
Conversation
Epic #2882 (Pillar 1, static layer), TDD. New ToolCapabilityExtractor in agents-kt-detekt: classifies what a tool's executor body actually does (FS_READ / FS_WRITE / NETWORK / ENVIRONMENT / EXEC) by walking call expressions and matching callee names. The reusable input the #2887 comparator checks against the declared ToolPolicy. - extract(scope: KtElement): Set<ToolCapability> — collects call expressions under a scope (the executor lambda) and classifies by callee name. - Conservative + syntactic by design (no FQN resolution); reflection/aliasing/ transitive state are Pillar-3 residual (documented). Over-classification only widens review for the comparator, never hides authority. - Not wired into the project's own detekt — it's infrastructure for #2887, not a standalone codebase rule. Tests (9, TDD RED->GREEN, via detekt-test compileContentForTest): fs-write, fs-read, Files.write/readAllBytes by nio names, network, environment, exec (ProcessBuilder + Runtime.exec), pure-compute = empty, bare File handle = empty, multi-capability body. CHANGELOG. Full ./gradlew build green.
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.
Slice 4 of epic #2882 — the last self-contained piece. New
ToolCapabilityExtractorinagents-kt-detekt. TDD. (Reframed from KSP to detekt — KSP can't see lambda bodies.)What
Statically classifies what a tool's executor body actually does —
FS_READ/FS_WRITE/NETWORK/ENVIRONMENT/EXEC— by walking its call expressions and matching callee names (writeText/Files.write→ write,readText/readAllBytes→ read,URL/openConnection→ network,getenv→ env,ProcessBuilder/Runtime.exec→ exec).extract(scope: KtElement): Set<ToolCapability>is the reusable input the #2887 comparator will check against the declaredToolPolicy. Not wired into the project's own detekt — it's infrastructure for #2887, not a standalone codebase rule.Honest limit: syntactic (callee-name match, no FQN resolution), intentionally conservative — over-classification only widens review for the comparator, never hides authority. Reflection / aliasing / transitive state are Pillar-3 residual (documented).
Tests (9, TDD RED→GREEN)
fs-write · fs-read ·
Files.write/readAllBytesby nio names · network · environment · exec (ProcessBuilder+Runtime.exec) · pure-compute = empty · bareFilehandle = empty · multi-capability body. Driven via detekt-testcompileContentForTest.Verified: full
./gradlew buildgreen. With this, all four self-contained slices of epic #2882 are done; #2887 (comparator) + the #2883/#2889 ABI are the remaining architectural core.🤖 Generated with Claude Code