Repository navigation
refactor(agents): Refine agent loading and skill processing logic - #698
Conversation
haiphucnguyen
commented
Sep 5, 2026
- Deprecates and removes Cursor agent support.
- Introduces dedicated parser and testing for Codex stream JSON events.
- Enhances agent streaming to prevent content loss by checking multiple event types.
- Improves skill repository by adding folder name sanitization and limits.
- Updates internal logging and test coverage across agents.
- Deprecates and removes Cursor agent support. - Introduces dedicated parser and testing for Codex stream JSON events. - Enhances agent streaming to prevent content loss by checking multiple event types. - Improves skill repository by adding folder name sanitization and limits. - Updates internal logging and test coverage across agents.
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed correctness issues in the new skill rename-on-save logic (frontmatter name: detection and an unsafe edge case that could rename the skills root directory).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors external-agent integration by removing Cursor support, adding a dedicated Codex JSONL event parser + tests, and improving streaming/materialization behavior so agent output and tool activity are less likely to be dropped or silently ignored.
Changes:
- Removed the Cursor external agent implementation and its stream-json parser.
- Added
CodexStreamJsonEventParserplus real-fixture tests, and updatedCodexAgentto consume structured--jsonevents (thread/turn/item lifecycle). - Improved skill folder handling and agent streaming: rename-on-save for
skill.mdfolders, stronger materialization diagnostics, and more robust Antigravity streaming/tool-call surfacing.
File summaries
| File | Description |
|---|---|
| shared/src/test/kotlin/io/askimo/core/skills/CodexStreamJsonEventParserTest.kt | Adds fixture-based tests for Codex --json JSONL event parsing. |
| shared/src/main/kotlin/io/askimo/core/agent/repository/SkillRepository.kt | Adds rename-on-save logic to keep skill folder names aligned with frontmatter name: (with collision handling). |
| shared/src/main/kotlin/io/askimo/core/agent/ExternalAgentTemplate.kt | Improves skill materialization logging/diagnostics and adds entrypoint presence warning. |
| shared/src/main/kotlin/io/askimo/core/agent/ExternalAgentLoader.kt | Removes CursorAgent from the registered external agents list. |
| shared/src/main/kotlin/io/askimo/core/agent/CursorStreamJsonEventParser.kt | Removes Cursor stream-json event parser (Cursor support deprecated). |
| shared/src/main/kotlin/io/askimo/core/agent/CursorAgent.kt | Removes Cursor external agent implementation. |
| shared/src/main/kotlin/io/askimo/core/agent/CodexStreamJsonEventParser.kt | Introduces a dedicated parser for Codex codex exec --json JSONL events. |
| shared/src/main/kotlin/io/askimo/core/agent/CodexAgent.kt | Switches Codex execution to --json, updates arg ordering, and parses structured events for output/tool calls/usage/errors. |
| shared/src/main/kotlin/io/askimo/core/agent/AntigravityAgent.kt | Avoids content loss by checking multiple response fields and routes tool-ish steps through onToolCall. |
| cli/src/test/kotlin/io/askimo/core/skills/SkillRepositoryTest.kt | Adds/updates tests for the new rename-on-save folder behavior and updates delete test accordingly. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (targetFolderName != null && targetFolderName != currentFolderName) { | ||
| val resolvedName = resolveAvailableFolderName(currentFolder.parent, targetFolderName, currentFolderName) | ||
| if (resolvedName != null) { |
| val hasExplicitName = content.contains(Regex("^name\\s*:", RegexOption.MULTILINE)) | ||
| val parsedName = if (hasExplicitName) { | ||
| runCatching { SkillMarkdownParser.parse(content, normalizedRelativePath, absolute).name }.getOrNull() | ||
| } else { | ||
| null | ||
| } |
There was a problem hiding this comment.
🟡 Changes recommended
The new rename-on-save logic in SkillRepository has edge cases that can trigger incorrect renames/collisions (blank name: and case-insensitive filesystem behavior).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Lite
|
|
||
| // Never rename when the entry file sits directly under skillsDir() itself — there's | ||
| // no containing skill folder to rename, and currentFolder would be the skills root. | ||
| if (targetFolderName != null && targetFolderName != currentFolderName && currentFolder != root) { |
| return lines.subList(1, closingIndex + 1).any { line -> | ||
| val colonIndex = line.indexOf(':') | ||
| colonIndex > 0 && line.substring(0, colonIndex).trim() == "name" | ||
| } |
There was a problem hiding this comment.
🔵 Needs a closer look
The new rename-on-save collision suffix logic can violate the stated folder-name length cap when appending -2, -3, etc., which should be corrected before merging.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
shared/src/main/kotlin/io/askimo/core/agent/repository/SkillRepository.kt:481
MAX_FOLDER_NAME_LENGTHis enforced insanitizeFolderName(), butresolveAvailableFolderName()appends-2,-3, ... without re-checking the length, so the final folder name can exceed the stated cap. Truncate the base name to leave room for the suffix before checking existence/returning the candidate.
- Files reviewed: 10/10 changed files
- Comments generated: 0 new
- Review effort level: Lite