-
Notifications
You must be signed in to change notification settings - Fork 43
[codex] add config setup skill routing #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| name: config-setup | ||
| description: Set up or tune .codemap/config.json so Codemap focuses on code-relevant parts of the repo. Use when config is missing, boilerplate, noisy, or mismatched to the stack. | ||
| --- | ||
|
|
||
| # Codemap Config Setup | ||
|
|
||
| ## Goal | ||
|
|
||
| Write or improve `.codemap/config.json` so future Codemap calls stay focused on the code that matters for this repo. | ||
|
|
||
| ## Use this when | ||
|
|
||
| 1. `.codemap/config.json` is missing | ||
| 2. The existing config looks like a bare bootstrap instead of a real project policy | ||
| 3. Codemap output is dominated by assets, fixtures, generated files, vendor trees, PDFs, screenshots, models, or training data | ||
| 4. The project stack is obvious, but Codemap is not prioritizing the right parts of the repo | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Inspect the repo quickly before writing config | ||
| - Run `codemap .` | ||
| - If needed, run `codemap --deps .` | ||
| - Note the stack markers (`Cargo.toml`, `Package.swift`, `*.xcodeproj`, `go.mod`, `package.json`, `pyproject.toml`, etc.) | ||
| - Identify large non-code directories and noisy extensions | ||
|
|
||
| 2. Decide whether config is missing, boilerplate, or tuned | ||
| - Missing: no `.codemap/config.json` | ||
| - Boilerplate: only generic `only` values, no real shaping, no excludes despite obvious noise | ||
| - Tuned: contains intentional project-specific includes/excludes, depth, or routing hints | ||
|
|
||
| 3. Write a conservative code-first config | ||
| - Keep primary source-language `only` values when they help | ||
| - Add `exclude` entries for obvious non-code noise | ||
| - Set a moderate `depth` when the repo is broad | ||
| - Avoid overfitting or excluding real source directories | ||
|
|
||
| 4. Prefer stack-aware defaults | ||
| - Rust: focus `src`, `tests`, `benches`, `examples`; de-prioritize corpora, sample PDFs, training data, large generated artifacts | ||
| - iOS/Swift: focus app/framework source, tests, package/project manifests; de-prioritize `.xcassets`, screenshots, snapshots, vendor/build outputs | ||
| - TS/JS: focus `src`, `apps`, `packages`, `tests`; de-prioritize `dist`, `coverage`, Storybook assets, large fixture payloads | ||
| - Python: focus package roots, tests, tool config; de-prioritize notebooks, data dumps, models, fixtures when they overwhelm code | ||
| - Go: focus packages, cmd, internal, tests; de-prioritize generated assets, sample data, vendor-like noise | ||
|
|
||
| 5. Preserve user intent | ||
| - If config already looks curated, do not replace it wholesale | ||
| - Make minimal edits and explain why | ||
|
|
||
| 6. Verify immediately | ||
| - Rerun `codemap .` | ||
| - If the repo still looks noisy, refine `exclude` and possibly `depth` | ||
| - Only rerun `codemap --deps .` after tree output looks reasonable | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -300,6 +300,8 @@ func hookSessionStart(root string) error { | |
| structureBudget := projCfg.SessionStartOutputBytes() | ||
| maxHubs := projCfg.HubDisplayLimit() | ||
|
|
||
| showConfigSetupHint(root) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new setup hint is only called at this point in Useful? React with 👍 / 👎. |
||
|
|
||
| exe, err := os.Executable() | ||
| if err == nil { | ||
| depth := limits.AdaptiveDepth(fileCount) | ||
|
|
@@ -782,6 +784,7 @@ func showMatchedSkills(root string, intent TaskIntent) { | |
| } | ||
|
|
||
| matches := idx.MatchSkills(intent.Category, intent.Files, langs, 3) | ||
| matches = injectConfigSetupSkill(root, idx, matches) | ||
| if len(matches) == 0 { | ||
| return | ||
| } | ||
|
|
@@ -808,6 +811,64 @@ func showMatchedSkills(root string, intent TaskIntent) { | |
| fmt.Printf("Skills matched: %s — run `codemap skill show <name>` for guidance\n", strings.Join(names, ", ")) | ||
| } | ||
|
|
||
| func injectConfigSetupSkill(root string, idx *skills.SkillIndex, matches []skills.MatchResult) []skills.MatchResult { | ||
| assessment := config.AssessSetup(root) | ||
| if !assessment.NeedsAttention() { | ||
| return matches | ||
| } | ||
|
|
||
| skill, ok := idx.ByName["config-setup"] | ||
| if !ok || skill == nil { | ||
| return matches | ||
| } | ||
| for _, match := range matches { | ||
| if match.Skill != nil && match.Skill.Meta.Name == "config-setup" { | ||
| return matches | ||
| } | ||
| } | ||
|
|
||
| reason := "config:" + string(assessment.State) | ||
| if len(assessment.Reasons) > 0 { | ||
| reason = reason + " " + assessment.Reasons[0] | ||
| } | ||
|
|
||
| injected := skills.MatchResult{ | ||
| Skill: skill, | ||
| Score: 100, | ||
| Reason: reason, | ||
| } | ||
| matches = append([]skills.MatchResult{injected}, matches...) | ||
| if len(matches) > 3 { | ||
| matches = matches[:3] | ||
| } | ||
| return matches | ||
| } | ||
|
|
||
| func showConfigSetupHint(root string) { | ||
| assessment := config.AssessSetup(root) | ||
| if !assessment.NeedsAttention() { | ||
| return | ||
| } | ||
|
|
||
| type configHint struct { | ||
| State string `json:"state"` | ||
| Reasons []string `json:"reasons,omitempty"` | ||
| } | ||
| if data, err := json.Marshal(configHint{ | ||
| State: string(assessment.State), | ||
| Reasons: assessment.Reasons, | ||
| }); err == nil { | ||
| fmt.Printf("<!-- codemap:config %s -->\n", string(data)) | ||
| } | ||
|
|
||
| fmt.Println("⚙️ Codemap config setup recommended:") | ||
| for _, reason := range assessment.Reasons { | ||
| fmt.Printf(" • %s\n", reason) | ||
| } | ||
| fmt.Println(" • Run `codemap skill show config-setup` and tune `.codemap/config.json` before deeper analysis.") | ||
| fmt.Println() | ||
| } | ||
|
|
||
| // showDriftWarnings checks and displays documentation drift warnings. | ||
| func showDriftWarnings(root string, cfg config.DriftConfig, routing config.RoutingConfig) { | ||
| warnings := CheckDrift(root, cfg, routing) | ||
|
|
@@ -1441,6 +1502,7 @@ func hookSessionStartMultiRepo(root string, childRepos []string) error { | |
|
|
||
| repoPath := filepath.Join(root, repo) | ||
| projCfg := config.Load(repoPath) | ||
| showConfigSetupHint(repoPath) | ||
|
|
||
| depth := 2 | ||
| if projCfg.Depth > 0 { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This skill lives under
.claude/skills/codemap-setup/but its frontmatternameisconfig-setup. If the Claude skill loader keys off the directory name (as it does for the existingcodemapskill), this mismatch can make the skill undiscoverable or confusing to reference. Consider renaming the directory to.claude/skills/config-setup/(and keepingname: config-setup) so the path and skill name align.