Add repository context explorer#98
Merged
Merged
Conversation
There was a problem hiding this comment.
2 issues found across 14 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/codex-claw/src/server/repo-context.ts">
<violation number="1" location="apps/codex-claw/src/server/repo-context.ts:248">
P1: Nested AGENTS.md files are not marked applicable when a parent directory is selected, so required instructions can be omitted from repository context.</violation>
<violation number="2" location="apps/codex-claw/src/server/repo-context.ts:343">
P2: Truncation appends a marker after slicing to `remaining`, which can exceed `maxContextChars` and break the prompt-size bound.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| const appliesToSelected = normalizedSelections.some((selection) => { | ||
| if (!selection) return false | ||
| if (!directory) return true | ||
| return selection === directory || selection.startsWith(directory + '/') |
There was a problem hiding this comment.
P1: Nested AGENTS.md files are not marked applicable when a parent directory is selected, so required instructions can be omitted from repository context.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/codex-claw/src/server/repo-context.ts, line 248:
<comment>Nested AGENTS.md files are not marked applicable when a parent directory is selected, so required instructions can be omitted from repository context.</comment>
<file context>
@@ -0,0 +1,361 @@
+ const appliesToSelected = normalizedSelections.some((selection) => {
+ if (!selection) return false
+ if (!directory) return true
+ return selection === directory || selection.startsWith(directory + '/')
+ })
+ return {
</file context>
| if (remaining <= 0) break | ||
| const body = | ||
| content.length > remaining | ||
| ? content.slice(0, remaining) + '\n[truncated]' |
There was a problem hiding this comment.
P2: Truncation appends a marker after slicing to remaining, which can exceed maxContextChars and break the prompt-size bound.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/codex-claw/src/server/repo-context.ts, line 343:
<comment>Truncation appends a marker after slicing to `remaining`, which can exceed `maxContextChars` and break the prompt-size bound.</comment>
<file context>
@@ -0,0 +1,361 @@
+ if (remaining <= 0) break
+ const body =
+ content.length > remaining
+ ? content.slice(0, remaining) + '\n[truncated]'
+ : content
+ usedChars += body.length
</file context>
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.
Summary\n- add an ignore-aware repository context API for the active workspace\n- detect root and nested AGENTS.md files and mark which ones apply to selected paths\n- add a composer repository-context picker with search, file/directory selection, AGENTS visibility, and context impact estimates\n- send selected repo context as a bounded prompt context block without starting a run from health/context checks\n\n## Testing\n- pnpm -C apps/codex-claw lint\n- pnpm -C apps/codex-claw build\n- pnpm -C apps/codex-claw test\n\nCloses #85
Summary by cubic
Adds a repository context explorer so users can pick files/folders for chats with ignore-aware scanning and AGENTS.md visibility. Selected context is sent as a bounded prompt block and can be used without typing a message. Closes #85.
/api/repo-contextreturns an ignore-aware repo tree, applicableAGENTS.mdfiles, and size/token estimates (selections via repeatedselectedparams).AGENTS.md; supports context-only sends and optimistic “Repository context: …” messages.git ls-files(with a safe fallback scan), normalizes paths, limits depth/entries, includes only text-like files, and truncates at ~32k chars.AGENTS.mdvisibility and prompt assembly.Written for commit 4297725. Summary will update on new commits.