agentleFS
thebiglaskowskithebiglaskowski/claude-sentient/.claude/skills/profile-detection/SKILL.md

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.

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
  1. Very specific:

    Check these exist, create from .claude-sentient/templates/ if missing: STATUS.md, CHANGELOG.md, DECISIONS.md, .claude/rules/learnings.md.

    line 54
  2. Very specific:

    Check for CLAUDE.md — if missing, report: [INIT] No CLAUDE.md found.

    line 56
  3. Very specific:

    Check for CLAUDE.local.md in project root.

    line 58
  4. Very specific:

    Conda env not activated: If environment.yml exists but commands run in system Python, the conda run -n <env> prefix was not applied.

    line 64

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Profile Detection Skill

Reference material for the /cs-loop INIT phase — detecting project profile, environment, and loading context.

Session State Recovery

  1. 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.
  2. Profile loading — Read .claude/state/session_start.json (created by session-start hook). Use the profile field. 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

IndicatorEnvironmentCommand Prefix
environment.ymlCondaconda run -n <env> --no-capture-output
.venv/, venv/VirtualenvActivate first or use .venv/bin/python
poetry.lockPoetrypoetry run
pdm.lockPDMpdm run

Report: [INIT] Environment: conda (myenv) or [INIT] Environment: system python

Web Project Detection

IndicatorsProfileAuto-load
next.config, vite.config, react, vue, svelteTypeScript Webui-ux-design
templates/, django, flask, jinja2Python Webui-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

ServerWhat to LoadWhen
context7Library docs for detected importsAlways (scan task-related files)
githubIssue/PR requirements, recent commitsWhen task references #issues or PRs
memoryPrior decisions/patterns matching task keywordsAlways (search nodes)
memoryCross-project global/org learningsAlways (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.yml exists but commands run in system Python, the conda 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 node triggers recursive shell function loading (500+ _nvm_load command not found lines). Hook commands must use absolute node paths via process.execPath. The fixHookPaths() function in session-start.cjs self-heals this, but if hooks fail with FUNCNEST errors, check that settings.json hook commands use absolute paths.
  • session_start.json stale or missing: The profile field 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-handling for a debug task that uses no keyword triggers). The semantic pass over rules/_index.md catches these — don't skip it.
  • Windows MCP servers: MCP servers require cmd /c npx wrapper on Windows, not direct npx. See learnings.md for the add-json pattern.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.