Skip to content

Feature: Project-level conventions file for Flow repos (avoid patterns, build commands, preferred idioms) #415

Closed

Description

@godofecht

Motivation

Every repo using Flow discovers the same compiler limitations and workarounds
independently. There is no standard mechanism for a Flow project to declare its
conventions, known-bad patterns, build commands, and preferred idioms in a way
that tools and agents pick up automatically.

Developers and AI agents hitting these limitations waste significant time
debugging silent failures (see #413) before discovering workarounds that other
projects already documented.

Proposal

Add support for a project-level conventions file that the Flow CLI and
downstream tools can read automatically. Suggested name: flow.toml or
.flowconfig, placed at the project root.

Fields

[project]
name = "flow-scikit"
version = "0.3.0"

[build]
host = "python"
test_command = "FLOW_HOST=python flow run tests/test_new_features.flow"
test_all = "for f in tests/test_*.flow; do FLOW_HOST=python flow run $f; done"

[conventions]
# Patterns to avoid, with the reason and workaround
avoid = [
  { pattern = "reverse for loop", reason = "generates incorrect step direction (#410)", workaround = "use while with explicit decrement" },
  { pattern = "return StructLiteral { field: func() }", reason = "fails to compile (#409)", workaround = "assign to locals first" },
  { pattern = "escaped quotes in strings", reason = "memory corruption (#408)", workaround = "avoid embedded quotes" },
  { pattern = "string concatenation with +", reason = "not supported (#412)", workaround = "use sequential print() calls" },
  { pattern = "scientific notation", reason = "parse error", workaround = "use 0.0000000001" },
]

[patterns]
# Preferred idioms for this project
math = "use fabs((x) as f64) as f32, sqrt((x) as f64) as f32, log((x) as f64) as f32"
structs = "passed by value; mutating functions must return the struct"
allocations = "use generous sizes (64+ bytes per struct) on arm64"
exports = "use export struct and export function for public API"

Behavior

  1. flow init creates a template conventions file in the current directory.
  2. flow run and flow build read the file for build settings (e.g. default
    host).
  3. flow check or flow lint warns when source code matches an avoid
    pattern.
  4. Tools and AI agents can read the file to understand project conventions
    without manual discovery.

Benefits

  • New contributors and agents learn the project's Flow patterns immediately.
  • Known compiler bugs are documented per-project with workarounds, so the same
    debugging does not repeat across repos.
  • Build and test commands are standardized and discoverable.
  • The lint step catches problematic patterns before runtime.

Alternatives considered

  • A global Flow wiki page: not project-specific, does not cover custom
    conventions or build commands.
  • Relying on AGENTS.md / CLAUDE.md: these are agent-specific and not read by
    the Flow CLI itself.
  • Embedding conventions in source comments: not machine-readable, easy to miss.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions