Skip to content

[codex] add config setup skill routing#61

Merged
JordanCoin merged 2 commits intomainfrom
codex/config-setup-skill
Mar 28, 2026
Merged

[codex] add config setup skill routing#61
JordanCoin merged 2 commits intomainfrom
codex/config-setup-skill

Conversation

@JordanCoin
Copy link
Copy Markdown
Owner

Summary

This adds a model-first config setup path so Codemap can guide repo tuning before deeper analysis instead of waiting for users to discover it manually.

What changed

  • added config assessment helpers to classify .codemap/config.json as missing, empty, boilerplate, malformed, or ready
  • surfaced setup guidance during session-start via a codemap:config marker and human-readable hint when config needs attention
  • automatically injects the config-setup skill into prompt-submit matches when the repo is clearly unconfigured
  • updated codemap config show to call out bootstrap configs and point users to codemap skill show config-setup
  • added a builtin config-setup skill and mirrored it into the Claude and Codex plugin skill bundles
  • updated the Codemap plugin metadata and skill docs so setup/tuning is framed as a first-use workflow

Why

Codemap works much better once per-project config reflects the actual stack and ignores noisy non-code trees. Today that setup is mostly manual and easy to skip, which makes first-run output noisy in repos with assets, fixtures, PDFs, training data, or generated files.

This change makes setup discoverable through the same model-facing surfaces users already touch: hooks, skills, and the plugin.

Impact

  • cold-start repo analysis should more often surface config-setup first when the repo is unconfigured
  • tuned repos stay quiet and do not get extra setup noise
  • users get a clearer path to making future Codemap calls better without learning another workflow first

Validation

  • go test ./...

@JordanCoin JordanCoin marked this pull request as ready for review March 28, 2026 00:04
Copilot AI review requested due to automatic review settings March 28, 2026 00:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “config-first” setup path so Codemap can detect when .codemap/config.json is missing/boilerplate/malformed and surface config-setup guidance early via hooks, skill routing, and plugin docs.

Changes:

  • Introduces config assessment helpers (AssessSetup, SetupState, IsZero, LooksBoilerplate) and uses them to drive setup hints and skill injection.
  • Updates hooks (session-start, prompt-submit) to emit a codemap:config marker + human hint and to inject config-setup into matched skills when config needs attention.
  • Adds/updates config-setup and Codemap skill documentation across builtin skills, plugin bundles, and .claude skill files; updates plugin metadata and codemap config show messaging.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
skills/builtin/config-setup.md Adds builtin config-setup skill content + metadata used for matching.
plugins/codemap/skills/config-setup/SKILL.md Adds config-setup skill to Codemap plugin bundle.
plugins/codemap/skills/codemap/SKILL.md Updates Codemap skill docs to recommend config tuning as a first-use workflow.
plugins/codemap/.codex-plugin/plugin.json Updates plugin descriptions and default prompts to emphasize config tuning.
config/config.go Adds setup assessment types/helpers and AssessSetup implementation.
config/config_test.go Adds unit tests for IsZero, LooksBoilerplate, and AssessSetup.
cmd/hooks.go Emits setup hint on session start and injects config-setup into matched skills when needed.
cmd/hooks_more_test.go Adds tests for skill injection and the new codemap:config hint output.
cmd/config.go Uses IsZero and surfaces boilerplate note in codemap config show.
cmd/config_more_test.go Adds test ensuring config show suggests tuning for boilerplate configs.
.claude/skills/codemap/SKILL.md Mirrors updated “config-first” guidance in Claude skill docs.
.claude/skills/codemap-setup/SKILL.md Adds Claude skill bundle entry for config-setup.
Comments suppressed due to low confidence (1)

cmd/config.go:172

  • configShow uses config.Load() (which returns a zero-value config on read/unmarshal errors) and then prints "Config is empty" when the file exists. This means a malformed or unreadable .codemap/config.json will be reported as empty instead of malformed/unreadable. Consider switching this early-return branch to use config.AssessSetup(root) so you can distinguish missing vs empty vs malformed and print the correct guidance.
func configShow(root string) {
	cfg := config.Load(root)
	if cfg.IsZero() {
		cfgPath := config.ConfigPath(root)
		if _, err := os.Stat(cfgPath); os.IsNotExist(err) {
			fmt.Println("No config file found.")
			fmt.Printf("Run 'codemap config init' to create %s\n", cfgPath)
		} else {
			fmt.Println("Config is empty (no filters active).")
		}
		return

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,52 @@
---
name: config-setup
Copy link

Copilot AI Mar 28, 2026

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 frontmatter name is config-setup. If the Claude skill loader keys off the directory name (as it does for the existing codemap skill), this mismatch can make the skill undiscoverable or confusing to reference. Consider renaming the directory to .claude/skills/config-setup/ (and keeping name: config-setup) so the path and skill name align.

Suggested change
name: config-setup
name: codemap-setup

Copilot uses AI. Check for mistakes.
Comment on lines +239 to +245
var cfg ProjectConfig
if err := json.Unmarshal(data, &cfg); err != nil {
return SetupAssessment{
State: SetupStateMalformed,
Reasons: []string{"The existing .codemap/config.json is malformed JSON."},
}
}
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssessSetup treats a zero-length / whitespace-only .codemap/config.json as malformed because json.Unmarshal fails. If you want the reported states to match the intent of having a distinct empty state, consider special-casing len(strings.TrimSpace(string(data)))==0 (or similar) to return SetupStateEmpty with an appropriate reason before attempting to unmarshal.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f192932ed9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

structureBudget := projCfg.SessionStartOutputBytes()
maxHubs := projCfg.HubDisplayLimit()

showConfigSetupHint(root)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Emit config-setup hint on multi-repo session starts

The new setup hint is only called at this point in hookSessionStart, but the function already returns early for meta-repos (len(childRepos) > 1) via hookSessionStartMultiRepo. In that common monorepo path, users with missing/boilerplate config never get the new codemap:config marker or human guidance, so the feature added in this commit is effectively skipped for multi-repo sessions.

Useful? React with 👍 / 👎.

@JordanCoin JordanCoin merged commit 44cead3 into main Mar 28, 2026
12 checks passed
@JordanCoin JordanCoin deleted the codex/config-setup-skill branch March 28, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants