🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@double-codeing/flow2spec

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@double-codeing/flow2spec

在业务仓库初始化「文档驱动、可写回知识库」的 AI 协作骨架:项目根 .Knowledge 承载 stock-docs/req-docs 与机读路由,.cursor/.claude/.codex 写入 f2s-* 规则与技能(含 Karpathy 式编码行为准则,init 同步 rules / Codex topics / skills);init 只落结构与模板,业务内容由各 f2s-* 技能在对话中维护。

latest
Source
npmnpm
Version
3.2.8
Version published
Weekly downloads
145
95.95%
Maintainers
2
Weekly downloads
 
Created
Source

Flow2Spec

Flow2Spec routes a natural language coding request into compact project facts before code edits

Give Cursor, Claude Code, and Codex the project facts they need before editing.

中文 · Live demo · Introduction · Usage guide · Commands

npm latest npm beta node version license

Flow2Spec adds a spec-driven workflow layer to AI coding agents. It creates a small, routable .Knowledge/ knowledge base, installs agent-specific f2s-* skills, and keeps optional local task state separate from product knowledge. A new session can load the facts relevant to a request instead of rediscovering the repository.

npx @double-codeing/flow2spec@latest init

Try the current beta:

npx @double-codeing/flow2spec@beta init

Why it exists

Without a maintained, routable project memory, an agent has to rediscover the same constraints on every request. Flow2Spec keeps those facts in compact topic shards and routes each request to the topics it needs.

Without Flow2SpecWith Flow2Spec
“Which module owns this table?”[matcher hit] m-product-review-template-library
“Is batchReScore sync or async?”[loading deps] 4 topics · ~300 lines
“Is there a lock? What is the idempotency key?”Redis lock ... TTL 10 min
Agent searches 416 APIs, 796 files, and 4.7 MB of source before editing.Agent reads the verified constraints first and opens the relevant files.

Flow2Spec does not add documentation for its own sake. It keeps a small, machine-readable knowledge layer alongside the code, and lets the same skills update it when verified facts change.

What you get

LayerWhat it doesFiles
Knowledge routingMaps a request to the few topics the agent needs to read..Knowledge/manifest-routing.json, .Knowledge/matchers/*.json
Topic shardsStores project facts such as APIs, limits, locks, data rules, and workflows..Knowledge/topics/*.md
Agent entrypointsInstalls rules and skills for Cursor, Claude Code, and Codex..cursor/, .claude/, .codex/, AGENTS.md
Skill workflowsClarifies requirements, writes specs, implements, fixes, syncs knowledge, and commits.f2s-* skills
Team collaborationKeeps each developer's task state local while merging reviewed knowledge through structured deltas and topic revisions..task/<developerId>/, .Knowledge/

Built for shared repositories

Flow2Spec separates collaboration state by ownership. Checklists, session context, and user todos stay under each developer's local TASK_ROOT and do not enter Git. Confirmed project knowledge remains shared in .Knowledge/.

Knowledge-producing skills write a structured kb-delta.json instead of editing topic files directly. Before apply, the CLI compares the delta's baseRevisions with the topic revisions on disk. Different topics can merge independently; concurrent changes to the same topic stop for a semantic review after the latest branch state is pulled.

Read the full model in Team Collaboration.

First use

After initialization, you do not need to document the whole project upfront. Start with the change you actually need. The agent reads the relevant code and existing docs while it works, then saves confirmed project facts back into the knowledge base.

For an existing project, you can ask the agent to draft the project structure first:

/f2s-doc-arch

This helps the agent understand the main directories, module boundaries, and existing conventions. It is optional. For a small change, you can start directly from the request.

Daily development

Most of the time, describe the task in natural language:

Add batch recalculation. It should retry failed items and avoid running the same batch twice.

The agent should look for relevant project knowledge first. If something is missing, it should explain the gap, then read the necessary code or ask you a follow-up question. Confirmed facts such as APIs, limits, locks, data rules, and workflows can be synced back into .Knowledge.

A larger change usually follows this path:

describe the requirement
  → agent fills in missing details
  → generate or review the technical spec
  → implement / fix
  → sync verified project facts
  → check knowledge coverage before commit

If you already know which workflow you want, use one of the explicit entrypoints below.

How the knowledge base grows

Flow2Spec's knowledge base is not meant to be finished in one pass. It grows with development:

  • init creates the base skeleton.
  • The first time a module matters, the agent reads the relevant code and docs.
  • Confirmed facts from the development process become routable topics.
  • Later similar requests can hit those topics directly instead of searching the whole repository again.

The directories can be read this way:

  • req-docs/: technical specs and implementation plans for concrete changes.
  • stock-docs/: stable project background, architecture notes, and imported source material.
  • topics/: compact facts the agent should actually load.
  • matchers/: rules that route a user request to the right topics.

Explicit skill entrypoints

Natural-language requests can select these workflows automatically when intent recognition is enabled. Use the entrypoints below when you want to choose one directly.

CommandPurpose
/f2s-req-clarifyClarify missing requirements until the change is unambiguous.
/f2s-req-techTurn confirmed requirements into an implementation-ready technical proposal.
/f2s-kb-featAdd a capability and update project knowledge.
/f2s-kb-fixFix behavior and correct the matching knowledge.
/f2s-kb-syncSync already implemented facts into .Knowledge/.
/f2s-kb-add <path>Import an existing module or document set.
/f2s-git-commitCheck changed files and knowledge coverage before committing.

Full references:

When not to use it

Flow2Spec is useful when context drift is expensive. It may be unnecessary for:

  • throwaway one-off scripts;
  • tiny solo projects where one CLAUDE.md is enough;
  • teams that will not keep .Knowledge/ aligned with the code.

Learn more

License

MIT

Keywords

flow2spec

FAQs

Package last updated on 04 Aug 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts