profile-detection
Skill2 starsChanged 7 months agoMITView on GitHub
Use when starting a cs-loop session, when profile detection fails or returns the wrong profile, when environment-specific commands (pytest, ruff, conda) aren't running correctly, or when session state needs recovery after context compaction.
In this repository6 other files it gives its agents.
- .claude/commands/CLAUDE.mdCLAUDE.md
- .claude/hooks/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/claude-sentient.mdcCursor rule
- quality-gatesSkill
- team-orchestrationSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 54
Check these exist, create from .claude-sentient/templates/ if missing: STATUS.md, CHANGELOG.md, DECISIONS.md, .claude/rules/learnings.md.
- Very specific: line 56
Check for CLAUDE.md — if missing, report: [INIT] No CLAUDE.md found.
- Very specific: line 58
Check for CLAUDE.local.md in project root.
- Very specific: line 64
Conda env not activated: If environment.yml exists but commands run in system Python, the conda run -n <env> prefix was not applied.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Profile Detection Skill
Reference material for the /cs-loop INIT phase — detecting project profile, environment, and loading context.
Session State Recovery
- Compaction recovery — Check
.claude/state/compact-context.json(written by pre-compact hook). If present, restore current task ID, recent file changes, decisions, and phase context. - Profile loading — Read
.claude/state/session_start.json(created by session-start hook). Use theprofilefield. If missing or stale, fall back to scanning for project indicator files (see.claude-sentient/profiles/CLAUDE.md). For gate commands, read.claude-sentient/profiles/{name}.yaml.
Python Environment Detection
| Indicator | Environment | Command Prefix |
environment.yml | Conda | conda run -n <env> --no-capture-output |
.venv/, venv/ | Virtualenv | Activate first or use .venv/bin/python |
poetry.lock | Poetry | poetry run |
pdm.lock | PDM | pdm run |
Report: [INIT] Environment: conda (myenv) or [INIT] Environment: system python
Web Project Detection
| Indicators | Profile | Auto-load |
| next.config, vite.config, react, vue, svelte | TypeScript Web | ui-ux-design |
| templates/, django, flask, jinja2 | Python Web | ui-ux-design |
Rule Auto-Loading
Rules with paths: frontmatter in .claude/rules/ are loaded automatically by Claude Code based on file context. For supplementary keyword-based loading, see .claude/rules/_index.md for the full keyword-to-rule mapping. The INIT phase does keyword matching first, then a semantic pass over .claude/rules/_index.md to catch logically relevant rules that keywords missed.
MCP Context Gathering
| Server | What to Load | When |
| context7 | Library docs for detected imports | Always (scan task-related files) |
| github | Issue/PR requirements, recent commits | When task references #issues or PRs |
| memory | Prior decisions/patterns matching task keywords | Always (search nodes) |
| memory | Cross-project global/org learnings | Always (search scope:global, scope:org) |
Dependency Changelogs
Trigger keywords: "update", "upgrade", "migrate", "bump". Use WebFetch to load CHANGELOG.md or release notes for the dependency being changed. Prevents breaking changes from surprising you.
Governance Files
Check these exist, create from .claude-sentient/templates/ if missing: STATUS.md, CHANGELOG.md, DECISIONS.md, .claude/rules/learnings.md.
Check for CLAUDE.md — if missing, report: [INIT] No CLAUDE.md found. Run /cs-init to create context architecture.
Check for CLAUDE.local.md in project root. If missing and first session, note: [INIT] Tip: Create CLAUDE.local.md for personal preferences (gitignored). Template: .claude-sentient/templates/CLAUDE.local.md
- Cross-model workflow: For high-stakes changes, consider Claude + Codex QA review. See
references/cross-model.md
Gotchas
- Conda env not activated: If
environment.ymlexists but commands run in system Python, theconda run -n <env>prefix was not applied. Always check for this indicator before running any Python commands. - nvm FUNCNEST explosion: On zsh systems with nvm, bare
nodetriggers recursive shell function loading (500+_nvm_load command not foundlines). Hook commands must use absolute node paths viaprocess.execPath. ThefixHookPaths()function in session-start.cjs self-heals this, but if hooks fail with FUNCNEST errors, check thatsettings.jsonhook commands use absolute paths. - session_start.json stale or missing: The
profilefield in session state may be from a previous session or absent on first run. Always fall back to scanning indicator files (pyproject.toml,tsconfig.json,go.mod, etc.) when the state file seems stale. - Two-step rule loading: Keyword matching alone misses logically relevant rules (e.g.,
error-handlingfor a debug task that uses no keyword triggers). The semantic pass overrules/_index.mdcatches these — don't skip it. - Windows MCP servers: MCP servers require
cmd /c npxwrapper on Windows, not directnpx. See learnings.md for theadd-jsonpattern.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

