Sections
On this page

bootstrap-spec

Use when a Flownix project's spec is empty or stale and the repository already has code and docs — triggers on "bootstrap the spec", "the project has no spec", "synthesize the spec from the repo", "собери спеку", "опиши проект по репозитори

Bootstrap the Project Spec

Give an agent a repeatable procedure to walk an existing repository and its documentation, synthesize a base project spec, and apply it to Flownix as the project spec plus a set of doc nodes. Prerequisite: read flownix-basics for the hierarchy, statuses, spec mode and the "ticket is memory" rule.

When to use

  • The project's spec (in the project config / on the project node) is empty or clearly stale.
  • spec_mode is strict and there is nothing yet to apply deltas against.
  • The project was just connected (flownix-init) to a repository that already has code and docs — the spec needs to catch up with reality, not be invented from scratch.

Workflow

0. Load project context

Read the project config (.flownix, or the older .ai-flow) from the working directory to get project_id/org_id:

shell
cat .flownix 2>/dev/null || cat .ai-flow

Parse the YAML and use project_id/org_id in all subsequent calls. If the config is missing, run flownix-init first.

Then call get_project_policy — the mode could have been switched to strict after init, and the value cached in the project config may be stale. The returned spec_mode governs step 4.

1. Inventory the sources

Read cheap, high-signal sources first; open code only when the manifests/docs don't already answer the question. Suggested order:

  1. README.md and docs/** (including any ADRs) at the repo root.
  2. CHANGELOG / release notes.
  3. Language/package manifests: go.work, go.mod (per module), package.json (per app).
  4. Service layout: services/** and any top-level app dirs (web, admin, landing, …).
  5. External contracts: proto/** plus buf.yaml/buf.gen.yaml.
  6. migrations/** (schema history, per service).
  7. Deployment: k3s/** (or other manifests), Dockerfile*, docker-compose.yml.
  8. CI workflows (.github/workflows/** or equivalent) and the root Makefile.

For each, note explicitly what exists and what doesn't — a missing category is a fact worth recording, not something to skip silently. Do not copy source code verbatim into the spec; summarize structure and contracts, not implementation detail.

2. Check what already exists

Before creating anything, search — a doc that already covers a topic should be updated, not duplicated:

shell
list_docs({ project_id })
rag_query({ project_id, query: "<topic of the section you're about to write>", k: 5 })

Run this per planned section (architecture, domain model, contracts, conventions, …). A hit means: update that doc. No hit means: create one. Treat an empty rag_query result together with a list_docs scan as the confirmation, not either alone — the index can lag a fresh write by a few seconds.

3. Synthesize

Read the project schema in flownix-basics — Node content schemas and the doc schema in flownix-write-spec before drafting their respective bodies. Read basics' Shared writing rules, Markdown for technical text and Check completeness before saving too. These are the common schemas; bootstrap does not define a separate format for either kind.

Use the inventory as evidence: purpose/scope, declared stack and versions, service boundaries, domain vocabulary, external contracts and build/test/release conventions. Keep every claim tied to a source from step 1; name contradictions and unknowns explicitly rather than turning them into promised behaviour. Put product context in the project body using its schema; describe observable behaviour in doc nodes using the doc schema. Large inventory reports go to artifacts with a short explanatory reference, not a substitute doc body.

3b. Write the behaviour parts in the standard format

Follow flownix-write-spec for the complete doc body and validate_spec; do not save the inventory headings as an alternative behaviour specification. Repository context can explain a contract, but cannot replace its requirements and scenarios. Preserve still-true content when updating an existing doc. Existing format issues may be returned as inherited warnings; a newly written inventory is not inherited content and must not be used to bypass validation.

4. Apply

Before every create/update, check the complete body against the selected kind's mandatory and applicable conditional sections and the linked Markdown rules. Verify every path, source and reference and remove empty sections/placeholders. Validate complete doc bodies through flownix-write-spec before create_doc_node, update_node_content, propose_doc_delta or update_doc_delta, using that skill's approval procedure where required. If mapping creates or updates components, apply the component schema through map-components as well.

This inventory does not authorise a backlog of implementation work. If a gap needs plans or tasks, use plan-feature (or spec-first-change when policy requires) and its shared planning self-review, including its task-sizing and proportional editorial checks. When profile: simple, keep the project context update but skip doc nodes, deltas and component mapping; offer a switch to full only with the user's consent.

  • Update the project spec (the spec field surfaced via the project config / project node) with the synthesized content.
  • Create or update doc nodes per section (create_doc_node for new ones), each bound to the components it describes — create_doc_node({ ..., components: ["AF-COMP-3"] }) or set_node_components afterwards. Several components per doc are normal: an architecture section describing gateway and core-service belongs to both. If the project has no components yet, run map-components first — the inventory in step 1 is exactly the input it needs, so do both in one pass rather than leaving the docs unbound.
  • Branch on spec_mode (from step 0):
    • strict — an existing doc can only change through propose_doc_delta (full new body, source node = this task) followed by apply_doc_delta. Never call update_node_content on a doc node in this mode.
    • off — update existing docs directly with update_node_content.

set_references from each doc node to the epics/features it documents, so the doc is reachable from the work it describes, not just from the doc list.

Rules

  • Every doc node ends up bound to at least one component; create the component when the part of the system it documents has none.
  • Every statement in the spec is backed by a file or a node; anything else belongs in Open questions & gaps, not asserted as fact. Never invent details.
  • Don't paste source code into the spec — summarize structure, contracts and conventions.
  • Re-running this skill on an already-bootstrapped project must update existing docs, not create duplicates: search (step 2) before every create.
  • Write the spec and doc nodes in the same language as the user's prompt that triggered this run.