From archcore
Sets up Archcore for a fresh clone: detects repo scale and seeds stack rule, run guide, entry-point inventory, optional top-level map, and hotspot candidates. Imports from existing agent files.
How this skill is triggered — by the user, by Claude, or both
Slash command
/archcore:init [--mode=small|medium|large][--mode=small|medium|large]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
First-time onboarding. Detects repo scale (small / medium / large) and seeds scale-appropriate `.archcore/` documents so push-mode (`check-code-alignment` hook) and pull-mode (`/archcore:context`) have substance to inject. Agent-file import (CLAUDE.md, AGENTS.md, .cursorrules) is the opt-in final step in every mode. Exact per-mode output is in the Routing Table below.
First-time onboarding. Detects repo scale (small / medium / large) and seeds scale-appropriate .archcore/ documents so push-mode (check-code-alignment hook) and pull-mode (/archcore:context) have substance to inject. Agent-file import (CLAUDE.md, AGENTS.md, .cursorrules) is the opt-in final step in every mode. Exact per-mode output is in the Routing Table below.
--mode=small|medium|large — force a mode, overriding auto-detection.
.archcore/ — the SessionStart nudge points here.Not init (route elsewhere):
/archcore:decide./archcore:plan./archcore:capture./archcore:decide (offers rule + guide continuation)./archcore:context./archcore:audit.Mode routing — Step 0.5 classifier, evaluated top-to-bottom, first match wins. The empty route is decided earlier in Step 0(b) and short-circuits the classifier entirely. Precise conditions for the rest in lib/detect-scale.md.
| Signal | Route | Seeded artifacts |
|---|---|---|
| No manifest AND no top-level source (Step 0b) | → empty | none — acknowledge-only, no placeholder docs |
--mode=X flag | → forced X (detected mode still reported) | per row below |
domain_count ≤ 1 AND module_count ≤ 15 | → small | stack rule, run guide |
domain_count ≤ 2 AND module_count ≤ 40 | → medium | small + entry-point inventory |
domain_count ≥ 3 OR module_count > 40 | → large | medium + top-level map + domain dialog |
Each non-empty mode additionally runs hotspot capture-candidate proposal (Step 6) and optional agent-file import (Step 8). Medium additionally runs cross-cutting rule candidate (Step 7). The empty route exits after Step 0.
Follow-up routing — closing-message hand-offs. Init surfaces these as todos; MUST NOT auto-invoke.
| User wants to... | → Invoke |
|---|---|
| Capture a hotspot module | /archcore:capture <path> |
| Record a decision | /archcore:decide |
| Codify a convention as a rule | /archcore:decide |
| Plan a feature | /archcore:plan |
| Drill into another domain (large) | /archcore:init --domain=<name> |
| Scope queries to a domain (large) | /archcore:context domain:<slug> |
| See what's loaded | /archcore:audit (short mode) |
Content voice: default to architectural prose — decisions, rationale, intent.
See skills/_shared/precision-rules.md Rule 6. Code blocks only where the
document type requires it (rule, guide, cpat) or the user asks.
Before any init step, verify that the Archcore CLI is available on PATH. The canonical installer is documented at https://docs.archcore.ai/cli/install/ — use it as the single source of truth; do not suggest other channels (brew, go install, etc.) even if the user mentions them.
archcore --version (via Bash tool)uname -s (Bash). Darwin/Linux → POSIX path. Anything else (Windows native) → instruct-only path.Archcore CLI not found. The official installer runs:
curl -fsSL https://archcore.ai/install.sh | bashRun it now? (y/N)
y → execute the command exactly as shown (Bash tool). After it returns, re-run archcore --version.
<version>). Proceeding with init." → go to Step -1.N / silence / instruct-only path → print and stop:
Archcore CLI required. Install it, then re-run
/archcore:init:
- macOS / Linux / WSL:
curl -fsSL https://archcore.ai/install.sh | bash- Windows (PowerShell 5.1+):
irm https://archcore.ai/install.ps1 | iex- Verify:
archcore --version- Full docs: https://docs.archcore.ai/cli/install/
Do not attempt brew install, go install, package-manager wrappers, or any other install command — they are not the supported path and will produce a CLI that is not version-compatible with the plugin.
Init MUST give the user fast feedback. The detection catalogs under skills/init/lib/ are heavy (≥ 350 lines for scale alone) and they are read lazily: do NOT open any lib/*.md file until you reach the step that explicitly tells you to read it. Step 0 finishes before any lib/ file is opened.
Call mcp__archcore__init_project() exactly once. It is idempotent — safe on an already-initialized project (returns existing settings). It creates .archcore/ and settings.json if missing.
Immediately after the call, give the user a one-line confirmation so they see something tangible without waiting for any detection:
initialized: true (created now) — print: "Archcore initialized at .archcore/."already_initialized: true — print nothing here; the existing knowledge base will speak for itself in Step 0(a).Do NOT ask the user to run archcore init in the terminal — mcp__archcore__init_project is the correct path in a plugin session.
Two cheap probes, in order. Each can short-circuit the whole skill. Neither reads anything under lib/.
Call mcp__archcore__list_documents() once. Derive:
has_stack_rule — any rule whose title contains "stack" in conventions/.has_run_guide — any guide whose title contains "run" or "running" in onboarding/.has_top_level_map — any doc with tag top-level-map.has_entry_points — any doc with tag entry-points.has_imports — any document with tag imported.If has_stack_rule AND has_run_guide are both true, reply:
Init already seeded stack rule and run guide. Use
/archcore:contextto see what's loaded, or re-run a specific step (say "regenerate the stack rule", "refresh the entry-point inventory", etc.).
Then stop. Per-step idempotency checks (below) handle mode-specific artifacts when the user asks for a selective refresh.
Single filesystem probe — one shell call, no catalog reads. Detect whether the repository has any executable shape yet:
has_manifest — at least one of these exists at the project root (depth ≤ 2 for monorepo workspaces): package.json, pyproject.toml, Pipfile, requirements.txt, Cargo.toml, go.mod, Gemfile, composer.json, *.csproj, *.fsproj, *.vbproj, pom.xml, build.gradle, build.gradle.kts, mix.exs, Package.swift.has_top_level_source — at least one file with a recognizable source extension exists anywhere under the project root, capped at depth 3, excluding .archcore/, .git/, node_modules/, vendor/, dist/, build/, out/, target/, coverage/, .venv/, __pycache__/, .next/, .turbo/. Extensions: .ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .rs, .go, .rb, .php, .java, .kt, .kts, .swift, .cs, .fs, .ex, .exs, .scala, .clj, .cljs.If BOTH are false, take the empty route. Reply with exactly:
Archcore is ready at
.archcore/. No source code detected yet — nothing to set up.Re-run
/archcore:initafter the first manifest or source file lands. The SessionStart empty-state nudge will keep pointing here until then.
Then stop. Do NOT create placeholder documents (no "no stack selected yet" rule, no "no run command yet" guide). They have no practical value, they cost MCP roundtrips and tokens, and they suppress the SessionStart empty-state nudge — which is the user's primary breadcrumb back to /archcore:init once code actually exists.
Otherwise (has_manifest OR has_top_level_source), proceed to Step 0.5.
Read skills/init/lib/detect-scale.md, detect-domains.md, and detect-modules.md.
--mode=X. If provided and valid (small|medium|large), record the forced mode.domain_count — per detect-domains.md.module_count — source files > 100 LOC, excluding tests and generated code.entry_point_count — per detect-entry-points.md (informational only).detect-scale.md. If --mode was forced, use the forced value but remember the auto-detected one for the announcement.<mode> (detected from <domain_count> domains, <module_count> modules). Override with /archcore:init --mode=X."<forced> (forced; auto-detected was <detected>)."Idempotency. If has_stack_rule, show existing rule's title + path. Ask: "Stack rule exists. Regenerate (overwrite), skip this step, or keep and continue?" On regenerate, warn manual edits will be lost.
Detect the stack. Read skills/init/lib/detect-stack.md for manifests, allowlist, exclusions, template.
Read in order, stopping at the first match per language: package.json, pyproject.toml, Pipfile, requirements.txt, Cargo.toml, go.mod, Gemfile, composer.json, *.csproj, pom.xml, build.gradle*. Polyglot repos: collect from each manifest.
Extract top-level (declared, not transitive) dependencies. Apply the allowlist + exclusions from detect-stack.md. Cap at 5 signals total.
No manifest → file-extension fallback on top-level source dirs (src/, lib/, app/, repo root) for majority language(s), up to 2.
Compose body per detect-stack.md template. Drop lines whose placeholder has no signal. Imperative, no versions, no library enumerations. ≤ 6 lines.
Create via mcp__archcore__create_document(type='rule', filename='project-stack', directory='conventions', title='Project stack', status='accepted', tags=['stack', 'conventions'], content=<body>).
Report: "Stack: → .archcore/conventions/project-stack.rule.md".
Idempotency. If has_run_guide, show existing guide's title + path. Ask same regenerate/skip/keep prompt as Step 1.
Detect shape. Read skills/init/lib/extract-run-instructions.md. Monorepo markers: pnpm-workspace.yaml, turbo.json, nx.json, lerna.json, OR ≥ 2 package.json under apps/ or packages/. Monorepo path is default in large mode; in small/medium, only when detected.
Extract commands — two paths, first-match wins:
README.md (or README.{en,ru,*}.md if absent). First section matching the regex in extract-run-instructions.md. Pull fenced bash/sh/shell/zsh blocks. Filter to install/run/test commands per extract-run-instructions.md.scripts: in package.json (or language equivalents: [tool.poetry.scripts], Cargo.toml [[bin]], Rakefile tasks, composer.json scripts). Pick dev, start, build, test, lint if present.Detect prerequisites from engines (package.json), [project].python (pyproject.toml), rust-version (Cargo.toml), go directive (go.mod). State as-is; do not invent.
Compose body per extract-run-instructions.md. Single-app ≤ 15 lines; monorepo per-app subsection ≤ 6 lines. Strip marketing prose — commands + prerequisites only.
Create via mcp__archcore__create_document(type='guide', filename='running-the-project', directory='onboarding', title='Running the project locally', status='accepted', tags=['onboarding'], content=<body>).
Report: "Run commands from <README section X / package.json scripts / user answer> → <path>".
Skip unless mode is large.
Idempotency. If has_top_level_map, ask regenerate/skip/keep.
Enumerate domains per detect-domains.md ranking rule. Collect (name, path, file_count, total_loc, auto_summary) per domain.
Compose body:
## Domains
| Domain | Path | Modules | Summary |
|---|---|---|---|
| <name> | `<path>` | <file_count> | <auto_summary> |
## Conventional roots
<e.g. "Monorepo under `apps/` (N workspaces) and `packages/` (M shared libs).">
## How to drill in
Run `/archcore:init --domain=<name>` for a focused per-domain pass later. Scope queries with `/archcore:context domain:<slug>`.
If ranked domains > 10, include top 10 in the table; list the rest on an "Also detected" line.
Create via mcp__archcore__create_document(type='doc', filename='top-level-map', directory='architecture', title='Top-level domain map', status='accepted', tags=['top-level-map', 'architecture'], content=<body>).
Report: "Top-level map → .archcore/architecture/top-level-map.doc.md (N domains)."
Skip in small mode.
Idempotency. If has_entry_points, ask regenerate/skip/keep.
Enumerate entry points per detect-entry-points.md. Bucket into HTTP, CLI, Worker, Cron, Other.
Compose body with one ## section per non-empty bucket:
## HTTP
- <path> — <signature>
## CLI
- <path> — <signature>
## Workers
- <path> — <queue name>
## Cron / scheduled
- <path> — <schedule>
## Other
- <path> — <short description>
In large mode, additionally group by domain using domain tags from detect-domains.md.
Nothing detected → single-line body:
No entry points detected automatically. This repo may be a pure library / SDK consumed by other projects.
Create via mcp__archcore__create_document(type='doc', filename='entry-points', directory='architecture', title='Entry-point inventory', status='accepted', tags=['entry-points', 'architecture'], content=<body>).
Report: "Entry points: <http_count> HTTP / <cli_count> CLI / <worker_count> workers → <path>."
Skip unless mode is large.
skip to defer.)" Accept single name, comma-separated list, or skip.mcp__archcore__update_document on the map. Add domain:<slug> tags for each selected domain (slugs per detect-domains.md "Domain tags"). Preserve existing tags — do not remove them./archcore:init --domain=<name> later to drill into any of them."Scope.
detect-modules.md).skip in Step 5, skip this step and note in closing.Rank per detect-hotspots.md. Apply thresholds and top-N per mode (small/large: 3; medium: 5).
Present as numbered list with rationale template from detect-hotspots.md. Example:
Hotspot capture candidates:
1. src/token-mutex.ts — 137 LOC source, 396 LOC tests. Suggested: spec. heavily tested (2.9:1).
2. src/token-rotation.ts — 235 LOC source, 968 LOC tests. Suggested: spec. heavily tested (4.1:1).
3. src/auth-client.ts — 52 LOC source, 0 LOC tests. Suggested: spec. concentrated public surface.
To capture any: run /archcore:capture <path>. For decisions: /archcore:decide. For rules: /archcore:decide.
Empty pool. No modules meet the threshold → use the exact closing text from detect-hotspots.md.
Sibling patterns. If detect-hotspots.md flagged ≥ 3 siblings, append its "Run /archcore:decide to codify..." line verbatim.
Do NOT auto-invoke /archcore:capture, /archcore:decide, or /archcore:decide. The output is a todo list; the user walks through at their own pace.
Skip in small and large modes.
Detect per detect-cross-cutting.md. Apply H1 / H2 / H3 heuristics. Pick at most one via priority H2 > H1 > H3.
No candidate → skip silently. Do not announce the step was skipped.
One candidate — show to user:
Detected cross-cutting pattern: . Seen in: , , (+ N more). Codify as a rule? (y/n)
On y — instruct the user: "Run /archcore:decide and paste this draft as the starting rule." Do NOT auto-invoke.
On n — skip silently.
Opt-in. Slowest, most token-intensive step — always confirm before starting.
Detect candidates per skills/init/lib/agent-files.md. For each probe path/glob: check existence, measure byte size. Empty set → announce "No agent-instruction files found." and finish.
Estimate cost. Sum bytes + count. Document yield estimate = ceil(combined_bytes / 800) (assumes ~800 bytes per extracted document block on average), capped at 25. Token estimate: combined_bytes * 2 for extract, ~200 * file_count for link.
Cost tier — HIGH if any: combined size > 50 KB OR file count > 5 OR yield > 8.
Prompt:
⚠️ HIGH COST: and require explicit do (not Enter/y/yes alone).Skip or declined HIGH → exit Step 8.
Skip already-imported. Call mcp__archcore__list_documents(tags=['imported']). For each detected file, compute its slug per agent-files.md "Source slugging". Match against existing source:<slug> tags. Report: "Skipping N files already imported."
Per-file mode. For each remaining file: "{path} ({size}) — link (default), extract, or skip?"
doc, single-line pointer body, zero content duplication.lib/extract-routing.md into rule / adr / doc.Accept batch answers ("link all" / "skip all").
Encoding: tag + body convention. MCP strips unknown frontmatter fields; encode source identity in tags + body instead:
Tags (mandatory):
imported — literal marker.source:<slug> — slug rules: lowercase alphanumeric + hyphens; dots → hyphens, slashes → hyphens; collapse repeated hyphens; preserve extension segment (prevents .md/.mdc collisions); leading . dropped before slugging. Examples: AGENTS.md → source:agents-md; .cursorrules → source:cursorrules; .cursor/rules/styling.mdc → source:cursor-rules-styling-mdc.Body first line (exact format):
> Imported from `<exact-relative-path>` on <ISO-8601-date>.
Use repo-root-relative path. Current date in YYYY-MM-DD.
Build create list.
create_document(type='doc', title='Imported: <basename>', directory='imports', filename='imported-<slug>', status='accepted', tags=['imported', 'source:<slug>'], content=<pointer-line-only>). Body < 200 bytes (empty-state threshold — a stubby import must not defeat the SessionStart nudge on an otherwise-empty repo).extract-routing.md. Same imported + source:<slug> tags, same pointer body first line + extracted content. Add related edges from each extracted document to an umbrella doc (create the umbrella first via link-mode rules).Dry-run preview. Before any creates: "Will create N documents: X rule(s), Y adr(s), Z doc(s). Confirm? (y/n)" On n, cancel all Step 8 creates without partial state.
Batch execute. create_document per item. Then add_relation for extract-mode umbrella links. Individual failure → roll forward (surface error, continue; do not delete successful creates).
Report one line per file: "<path> → created N documents (link/extract)" or "skipped".
Summarize what was created and what remains in the tracked-context outlook. Per-mode template.
Small:
Done. Seeded: stack rule, run guide. Proposed: N hotspot captures.
Over time: ADRs for non-trivial dependency choices (
/archcore:decide), specs for hotspot modules (/archcore:capture <path>), a task-type for any repeating extension pattern (/archcore:decide). Edit a file matching the stack rule — relevant context auto-injects viacheck-code-alignment. Use/archcore:contextto query what applies to a code area.
Medium:
Done. Seeded: stack rule, run guide, entry-point inventory. Proposed: N hotspot captures[, 1 cross-cutting rule candidate].
Over time: ADRs for architectural decisions (persistence, auth, observability), specs for hotspot modules, rules per cross-cutting concern (logging, error-handling, request-context), task-types for common change patterns. Run
/archcore:decide,/archcore:capture,/archcore:decide,/archcore:planas the work takes you there.
Large:
Done. Seeded: workspace stack rule, monorepo run guide, top-level map (N domains), entry-point inventory. Focused on: . Proposed: M hotspot captures in selected domains.
Over time, each domain needs its own ADRs, specs, and task-types. Repo-wide: cross-cutting rules (logging, errors, auth, transactions, telemetry). Run
/archcore:init --domain=<name>later for other domains. Use/archcore:context domain:<slug>to scope queries.
Always end with:
Use
/archcore:auditfor a dashboard,/archcore:audit --deepfor a health audit.
Mode-appropriate .archcore/ seed:
.archcore/ and settings.json only. Fast acknowledge + early exit. No catalog files read.rule, guide) + 3 hotspot proposals.rule, guide, entry-point doc) + 5 hotspot proposals + ≤ 1 cross-cutting rule candidate.rule, guide, top-level-map doc, entry-point doc) + domain selection + 3-per-domain hotspot proposals.All seeds idempotent. Agent-file import is opt-in and previewed. The empty route never creates placeholder documents — it keeps .archcore/ functionally empty so the SessionStart nudge continues pointing the user back here.
npx claudepluginhub archcore-ai/pluginBootstraps repositories with harness engineering scaffolding: AGENTS.md orientation map, docs/ system of record, boundary tests, linter rules, CI pipeline, GC scripts. Use for new projects, agent-readiness, or architecture boundaries.
Guides structured conversations to define repository architecture principles in clean (default), hexagonal/ports & adapters, modular monolith, or custom styles. Produces formal architecture.md document for project standards.