AIMFP

io.github.aryanduntleyPublished by GitHub account aryanduntleyv1.70.0Updated Nov 1, 2026

Database-driven directives and project tracking for modular functional-procedural AI coding

Overview

AI-generated overview

AIMFP is a local MCP server that keeps a SQLite-backed map of a software project — themes, flows, modules, tasks and functions — so an assistant tracks and…

What you can do
  • Initialize and run a project session: create the project folder and databases, load a session bundle, check status, and close out with an audit.
  • Model the architecture: add themes, flows, completion paths, milestones, modules, and assign files to modules and flows.
  • Track work: create tasks, subtasks, sidequests and items, and record notes and decisions in an audit trail.
  • Index code: record functions, types and their dependencies, and link types to the functions that use them.
  • Audit the index against source: check files, functions, interactions and descriptions for drift, and apply fixes in one transaction.
  • Manage directives and preferences: store user directives, settings and per-directive…
When to use it
Worth adding when you want an assistant to keep persistent, structured project memory across sessions and to enforce a modular, functional-programming workflow with tracked tasks and code indexes. It suits larger codebases where re-reading files each session is costly, and teams wanting audit and Git-aware collaboration. It is a poor fit for small scripts or projects that use object-oriented code, which it rejects.
Requirements
Runs locally over stdio as a Python package (aimfp on PyPI, launched with uvx or python3 -m aimfp). Python 3.11+ is required; uv is needed for the plugin route. Developed and tested on Linux only; macOS and Windows are unsupported. No API keys or authentication. The system prompt must be installed into the client (CLAUDE.md or custom instructions) for the tools to be used.
Before you install
The server instructs assistants to call its tools first every session and to track all work, which adds token overhead and overrides normal exploration habits. It writes a .aimfp-project folder with several SQLite databases in your project and expects to modify project files and database records. It enforces functional-programming rules and rejects OOP codebases. Installing both the plugin and a .mcp.json entry starts two servers and duplicates every tool. Pre-approving all tools skips…

Installation

In SourceWeft

  1. Open AIMFP in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

AIMFP: AI Modular Functional Procedural Programming

[PyPI]

A language-agnostic programming paradigm designed for AI-generated and AI-maintained codebases


Table of Contents


What is AIMFP?

AIMFP (AI Modular Functional Procedural) is a programming paradigm that combines:

  • Pure functional programming principles (referential transparency, immutability, composability)
  • Procedural execution patterns (explicit sequencing, no hidden state)
  • Database-driven project management (persistent state, instant context retrieval)
  • Directive-based AI guidance (deterministic workflows, automated compliance)

Two Ways to Use AIMFP

Use Case 1: Regular Software Development

  • Build applications (web apps, libraries, CLI tools, etc.)
  • AIMFP enforces FP compliance and manages your project
  • You write code, AI assists with FP standards and project tracking
  • Example: Building a web server, calculator library, data processor

Use Case 2: Custom Directive Automation

  • Define automation rules (home automation, cloud management, workflows)
  • AIMFP generates and manages the automation codebase for you
  • You write directive definitions (YAML/JSON/TXT), AI generates the implementation
  • The project's code IS the automation code generated from your directives
  • Example: Smart home control system, AWS infrastructure manager, workflow automator

Key Principle: One AIMFP instance per project directory. You would NOT mix a web app with home automation directives. Run separate instances for separate purposes.

Why AIMFP?

Traditional programming paradigms were designed for humans. AIMFP is optimized for AI-human collaboration:

ChallengeTraditional ApproachAIMFP Solution
Context LossAI forgets between sessionsDatabase-driven persistent state
OOP ComplexityClasses, inheritance, polymorphismPure functions, explicit data structures
Infinite DevelopmentProjects never "complete"Finite completion paths with milestones
Code ReasoningParse source code repeatedlyPre-indexed functions, dependencies, interactions
Inconsistent StandardsStyle guides, linters, reviewsImmutable directives enforcing compliance

Core Principles

1. Functional-Procedural Hybrid

python
# ✅ AIMFP-Compliantdef calculate_total(items: List[Item]) -> float:    """Pure function: deterministic, no side effects"""    return reduce(lambda acc, item: acc + item.price, items, 0.0)
# ❌ Not AIMFP-Compliantclass Calculator:    def __init__(self):        self.total = 0  # Hidden state
    def add_item(self, item):        self.total += item.price  # Mutation

2. Database-Indexed Logic

Every function, file, and dependency is tracked in SQLite. AI accesses this data through helper tools — not raw SQL:

AI calls: get_functions_by_file(file_id)→ Returns: all functions in that file with name, purpose, parameters, returns

No source code reparsing required. Instant context retrieval across sessions.

3. AI-Readable Code

  • Flat structure: No deep inheritance hierarchies
  • Explicit dependencies: All parameters passed explicitly
  • Pure functions: Same inputs → same outputs
  • Metadata annotations: Machine-readable function headers

4. Finite Completion Paths

Project: MatrixCalculator├── Completion Path (3 stages)│   ├── 1. Setup (completed)│   ├── 2. Core Development (in progress)│   │   ├── Milestone: Matrix Operations│   │   │   ├── Task: Implement multiply│   │   │   ├── Task: Implement transpose│   │   │   └── Task: Add validation│   │   └── Milestone: Vector Operations│   └── 3. Finalization (pending)

5. Language-Agnostic

AIMFP works with Python, JavaScript, TypeScript, Rust, Go, and more. FP directives adapt to language-specific syntax while maintaining universal standards.


Architecture Overview

┌─────────────────────────────────────────────────────┐│            AI Assistant (Claude, GPT-4, etc.)        ││  - Receives natural language commands                ││  - Follows directives (FP baseline + project mgmt)   ││  - Calls MCP tools to read/write databases           ││  - Generates FP-compliant code                       │└────────────────────┬────────────────────────────────┘                     │ MCP Protocol (JSON-RPC over stdio)┌────────────────────▼────────────────────────────────┐│                 MCP Server                           ││  - Exposes helper tools via JSON-RPC                  ││  - Manages four-database connections                 ││  - Provides CRUD helpers for all databases           ││  - No business logic — AI makes all decisions        │└───┬────────────────────┬─────────────────────────┬──┘    │                    │                         │┌───▼──────────────┐ ┌───▼────────────────┐ ┌─────▼─────────────────┐ ┌──────▼────────────────┐│  aimfp_core.db    │ │  project.db        │ │  user_preferences.db  │ │  user_directives.db   ││  (Global,        │ │  (Per-Project,     │ │  (Per-Project,        │ │  (Per-Project,        ││   Read-Only)     │ │   Mutable)         │ │   Mutable)            │ │   Optional)           ││                  │ │                    │ │                       │ │                       ││ - FP directives  │ │ - Project metadata │ │ - Directive prefs     │ │ - User directives     ││ - Project mgmt   │ │ - Files & funcs    │ │ - User settings       │ │ - Execution stats     ││ - User prefs     │ │ - Task hierarchy   │ │ - AI learning log     │ │ - Dependencies        ││ - User systems   │ │ - Themes & flows   │ │ - Tracking features   │ │ - Generated code refs ││ - Helper defs    │ │ - Completion path  │ │ (All opt-in)          │ │ - Source file tracking││ - Directive flow │ │ - Runtime notes    │ │                       │ │ (Logs in files)       │└──────────────────┘ └────────────────────┘ └───────────────────────┘ └───────────────────────┘

Use Case 2 adds a second path that never touches the MCP server. Your automation has to run when no AI session is open, so it imports AIMFP as a plain library instead:

┌──────────────────────────────┐        ┌──────────────────────────────┐│  cron / systemd / your daemon │        │  AI Assistant (a session)     ││  runs forever; AIMFP does not │        │  present only when you are    │└───────────────┬──────────────┘        └───────────────┬──────────────┘                │ starts                                 │ MCP┌───────────────▼──────────────┐        ┌───────────────▼──────────────┐│  runner.py  (YOUR project)    │        │         MCP Server            ││  generated by AIMFP, owned    │        │                               ││  and editable by you          │        │  check_directive_health       ││                               │        │  get_directive_execution_stats││  import aimfp.hooks  ◄────────┼── a    │  get_recent_directive_errors  ││  get_due_directives(...)      │  library                              ││  run_directive(...)           │  call, └───────────────┬──────────────┘└───────────────┬──────────────┘  not RPC               │ reads                │ writes                                 │                └────────────►  user_directives.db  ◄────┘                                + .aimfp-project/logs/

The runner writes; the AI reads it back later. AIMFP itself is inert in between — it has no timer and starts nothing.


Database Architecture

aimfp_core.db (Global, Read-Only)

Location: Within MCP server installation directory (user-defined location, configured in AI client)

Purpose: Immutable knowledge base containing all AIMFP standards, directives, and helper definitions.

Key Tables:

  • directives: All FP, project, and user preference directives (workflows, keywords, thresholds)
  • helper_functions: Database, file, Git, and FP utilities organized across multiple registry files
  • directive_helpers: Many-to-many junction table mapping directives to their helper functions with execution metadata
  • categories: Directive groupings (purity, immutability, task management, etc.)
  • directive_flow: Status-driven directive navigation and routing

Helper-Directive Relationship (New in v1.4):

  • One directive can use many helpers, one helper can serve many directives
  • Junction table stores: execution context, sequence order, parameter mappings
  • Enables flexible helper reuse and clear execution flow
  • Defined in directive_helpers junction table in aimfp_core.db

Helper Classification:

  • Tool: All helpers are exposed as MCP tools (AI calls directly via MCP)
  • Sub-helper (is_sub_helper = TRUE): Internal utility called by other helpers only (not exposed to AI)

Helper Registry (Development Staging):

  • Helper definitions maintained in dev/helpers-json/*.json during development
  • Developers modify JSON files, then import to database when complete
  • Each helper includes used_by_directives field for relationship mapping
  • Database import script populates aimfp_core.db from JSON files before release
  • Production: Users query aimfp_core.db (pre-populated), NOT JSON files
  • JSON files are dev-only staging area, never shipped with package

Read-Only Philosophy: This database is version-controlled and immutable once deployed. AI reads from it but never modifies it.

project.db (Per-Project, Mutable)

Location: <project-root>/.aimfp-project/project.db

Purpose: Persistent state for a single AIMFP project. Tracks code structure, tasks, and runtime notes.

Key Tables:

  • project: High-level metadata (name, purpose, goals, status, user_directives_status, last_known_git_hash)
  • files, functions, interactions: Code structure tracking
  • themes, flows: Organizational groupings
  • completion_path, milestones, tasks, subtasks, sidequests, items: Hierarchical roadmap
  • task_files: Files worked on for each task/subtask/sidequest — linked automatically while the item is in progress
  • modules, module_files, file_flows: Reusable code boundaries and file-to-flow assignments
  • notes: Runtime logging with optional directive context (source, severity, directive_name)
  • types: Algebraic data types (ADTs)
  • infrastructure: Project setup (language, packages, testing)
  • work_branches: Git collaboration metadata (user, purpose, merge strategy)
  • merge_history: FP-powered merge conflict resolution audit trail

User Directives Integration: The project.user_directives_status field tracks whether user directives are initialized (NULL/in_progress/active/disabled), allowing aimfp_run and aimfp_status directives to include user directive context when active.

Enhanced Notes: The notes table now includes source (user/ai/directive), directive_name (optional context), and severity (info/warning/error) for better traceability.

user_preferences.db (Per-Project, Mutable)

Location: <project-root>/.aimfp-project/user_preferences.db

Purpose: User-specific AI behavior customizations and opt-in tracking features.

Key Tables:

  • directive_preferences: Per-directive behavior overrides (atomic key-value structure)
  • user_settings: Project-wide AI behavior settings
  • tracking_settings: Feature flags for opt-in tracking (all disabled by default)
  • ai_interaction_log: User corrections and learning data (opt-in)
  • fp_flow_tracking: FP compliance history (opt-in)
  • issue_reports: Contextual bug reports (opt-in)

Cost Management Philosophy: All tracking features disabled by default to minimize API token usage. Project work should be cost-efficient; debugging and analytics are opt-in.

User Customization Example:

sql
-- User says: "Always add docstrings"INSERT INTO directive_preferences (directive_name, preference_key, preference_value)VALUES ('project_file_write', 'always_add_docstrings', 'true');
-- Next file write automatically includes docstrings

user_directives.db (Per-Project, Optional)

Location: <project-root>/.aimfp-project/user_directives.db

Purpose: Store user-defined domain-specific directives for automation (home automation, cloud infrastructure, etc.). When this database exists, the AIMFP project IS dedicated to building and managing the automation code generated from these directives.

This database only exists in Use Case 2: Custom Directive Automation projects. In regular software development projects, this database is not created.

Key Tables:

  • user_directives: Directive definitions (triggers, actions, status, validated configuration). trigger_config and action_config have an enforced grammar — see Directive Configuration Schema
  • directive_executions: Execution statistics (summary only, detailed logs in files)
  • directive_dependencies: Required packages, APIs, environment variables
  • directive_implementations: Links directives to generated code files
  • helper_functions: AI-generated helper functions (project-specific implementation utilities)
  • directive_helpers: Many-to-many junction table mapping user directives to their helpers
  • source_files: Tracks user directive source files (YAML/JSON/TXT)
  • logging_config: File-based logging configuration

Helper Functions (New in v1.0):

  • AI generates project-specific helper functions for user directives
  • Tracked with implementation status: not_implemented → generated → tested → approved
  • Enforces FP compliance (pure functions) for all generated code
  • Same many-to-many relationship pattern as aimfp_core.db

File-Based Logging Philosophy: Database stores state and statistics only. Detailed execution logs (30-day retention) and error logs (90-day retention) are stored in rotating files at .aimfp-project/logs/.

Directory Structure Comparison:

# Use Case 1: Regular Software Developmentmy-web-app/├── src/                    # Your application code├── tests/                  # Your tests└── .aimfp-project/          # AIMFP tracks your application    ├── project.db    └── user_preferences.db
# Use Case 2: Custom Directive Automationhome-automation/├── directives/             # ← User writes directive files here│   ├── lights.yaml│   └── security.yaml├── src/                    # ← AIMFP GENERATES this code│   ├── lights_controller.py│   ├── security_monitor.py│   └── runner.py           # ← the RUNNER: your scheduler calls this,│                           #    it imports aimfp.hooks as a library├── tests/                  # ← AIMFP GENERATES tests└── .aimfp-project/          # ← AI-managed only, user never touches    ├── project.db          # Tracks generated src/ code    ├── user_preferences.db    ├── user_directives.db  # References ../directives/ files    └── logs/               # 30/90-day execution logs
# ...and outside the project entirely:/etc/cron.d/home-automation  # ← what actually STARTS runner.py. Not AIMFP.

Example Workflow (Automation Project):

  1. User creates directives/lights.yaml in their project
  2. User tells AI: "Parse my directive file at directives/lights.yaml"
  3. AI parses and validates through interactive Q&A
  4. AI generates FP-compliant implementation code in src/
  5. AI tracks generated code in project.db (files, functions, tasks)
  6. AI generates a runner and wires up your scheduler (cron, systemd, or a daemon loop)
  7. Your scheduler runs the directives — AIMFP has no timer and is not running at 3am
  8. The runner records each execution through aimfp.hooks; logs land in .aimfp-project/logs/, statistics in user_directives.db
  9. Next session, AIMFP reports what happened and what looks broken

Note: User directive files stay in the user's project. .aimfp-project/ is AI-managed metadata.

Directive Configuration Schema

Triggers and actions have an enforced grammar. A non-conforming config is refused at insert — a bad action fails loudly at runtime, but a bad schedule fails silently by never firing, so both are checked before they are stored.

Triggers — time triggers are a discriminated union on kind:

jsonc
{"kind": "interval", "seconds": 900}{"kind": "daily",    "at": "17:00", "timezone": "America/New_York"}{"kind": "weekly",   "at": "17:00", "weekdays": ["mon","wed","fri"]}{"kind": "monthly",  "at": "09:00", "days": [1, 15]}
{"event": "stove_on", "source": "home_assistant"}              // event{"expression": "cpu > 90", "evaluate_every_seconds": 60}       // condition (fires once per rise){"expression": "cpu > 90", "repeat": "while_true"}             // condition (fires every true check){}                                                             // manual

at is 24-hour HH:MM, zero-padded. timezone is an IANA name, and is not valid on an interval — an interval counts elapsed seconds. Unknown keys are errors, because a typo'd schedule key would otherwise validate cleanly and then never fire.

Actions — an envelope per action_type:

jsonc
{"endpoint": "/lights/off", "api": "homeassistant", "method": "POST"}  // api_call{"script": "scripts/backup.sh", "args": ["--full"]}                    // script_execution{"command": "systemctl restart nginx"}                                 // command{"function": "handlers.lights.turn_off"}                               // function_call{"message": "Backup finished", "channel": "ops"}                       // notification

For function_call and command, AIMFP validates the envelope only — the function or executable exists in your generated project, so whether it actually resolves is yours to check.

AIMFP also owns the schedule arithmetic: aimfp.hooks.schedule.next_fire_time computes the next run (wall-clock-correct across DST boundaries), and record_execution_end advances next_scheduled_time automatically after every run. Your runner never needs to hand-roll calendar maths — that is how two projects end up disagreeing about when 17:00 is.

One consequence to know if you build a UI: next_scheduled_time is stored as naive local time, because is_due compares it against a naive local now. A schedule declared as 17:00 in America/New_York is stored as 14:00 on a machine in Los Angeles. Nothing is lost — the declared zone stays in trigger_config — but the column is a comparison value, not a rendering. Show a user their schedule from trigger_config, never from next_scheduled_time, or they will "fix" a config that was already correct.

AIMFP never evaluates a condition, but the grammar says how often a held one fires. By default a condition fires once when it becomes true and re-arms when an evaluation finds it false; "repeat": "while_true" fires on every true evaluation. The runner keeps that latch with set_condition_state, so a restart does not re-fire a condition that is still true. A time slot the runner reaches too late is skipped, never caught up, and recorded with record_directive_skip. A skip counts as neither a run nor an error, and a directive that keeps skipping is reported skipping rather than a false ok.

The AI validates configs with the validate_trigger_config and validate_action_config tools, which return the expected shape alongside any errors. The full spec is available as data from the trigger_config_grammar() and action_config_grammar() hooks.


How It Works

1. AIMFP MCP Gateway Pattern

The aimfp_run command serves as a gateway and reminder, not an executor. It tells the AI that AIMFP directives should be applied.

Every aimfp_run call returns:

json
{  "success": true,  "message": "AIMFP MCP available",  "guidance": {    "directive_access": "Directive names cached from session bundle. Query specific directives by name when needed.",    "when_to_use": "Use AIMFP directives when coding or when project management action/reaction is needed.",    "assumption": "Always assume AIMFP applies unless user explicitly rejects it."  }}

The MCP server exposes CRUD helper functions for all database operations — tracking files, functions, tasks, project state, user preferences, and (for Use Case 2) automation directives. AI discovers available helpers from the database at runtime.

AI Decision Flow:

  1. User prefixes request with aimfp run (or AI assumes it)
  2. AI calls aimfp_run tool → receives guidance
  3. AI evaluates: Is this coding or project management?
  4. If yes: Check if directives are in memory
    • No directives? → Directive names cached from session bundle; query by name when needed
    • Has directives? → Apply appropriate ones
  5. If no: Respond without directives

2. Command Flow Example

User: "Help me build a calculator"

AI Processing:

  1. Calls aimfp_run(is_new_session=true) → receives session bundle (directive names, project status, settings, supportive context)
  2. Checks project state from bundle: .aimfp-project/ missing → project not initialized
  3. Calls aimfp_init helper (Phase 1: mechanical setup)
    • Programmatically creates .aimfp-project/ directory, databases, blueprint template
  4. Enters Phase 2 (intelligent population): detects language/tools, discusses project with user
  5. Routes to project_discovery: collaborates with user on blueprint, themes, flows, completion path, milestones
  6. Discovery complete → routes to aimfp_status → project_progression → first task created
  7. Work begins

3. Self-Assessment Framework

Before acting, AI performs self-assessment using questions provided with directives:

Core Questions:

  1. Does this involve coding or project state changes?

    • Coding and project management are unified — writing code triggers file tracking, DB updates, and task progress automatically
    • FP baseline is always active as the mandatory coding style
    • Project directives handle the tracking side (file writes, DB updates, task management)
  2. Do I have directives in memory?

    • No: Load from session bundle via aimfp_run(is_new_session=true)
    • Yes: Proceed with cached directives
  3. Which directives apply?

    • FP baseline: Mandatory coding style (pure functions, immutability, no OOP) — applied naturally, not as directive calls
    • FP directives: Reference documentation only — consulted when uncertain about complex scenarios
    • Project directives: File writes, DB updates, task management
  4. Action-reaction needed?

    • Code write → project_file_write directive → DB update
    • File edit → DB sync
    • Discussion with decision → DB update

Example Flow (Coding Task):

User: "Write multiply_matrices function"AI thinks:  ✓ FP baseline applies (write pure, immutable, no OOP)  ✓ Project tracking applies (project_file_write directive)  ✓ I have directives in memory
AI executes:  1. Write function following FP baseline naturally  2. Apply project_file_write directive  3. Update project.db (files, functions, interactions)

4. Directive Execution

Directives follow a trunk → branches → fallback pattern:

json
{  "trunk": "analyze_function",  "branches": [    {"if": "pure_function", "then": "mark_compliant"},    {"if": "mutation_detected", "then": "refactor_to_pure"},    {"if": "low_confidence", "then": "prompt_user"},    {"fallback": "prompt_user"}  ]}

Getting Started

Prerequisites

  • Python 3.11+ (required for type hint syntax used throughout; developed and tested through 3.14)
  • Linux — see Platform Support below

Platform Support

AIMFP is developed and tested on Linux only. There is no platform-conditional code anywhere in the codebase, so Windows and macOS support is unbuilt rather than untested — it has never been attempted, and making it work would be real porting effort, not a compatibility pass.

The core of the server is portable in principle (pure-stdlib JSON-RPC over stdio, SQLite, pathlib), so parts of it may happen to run elsewhere. Nothing about that is verified or supported. If you run AIMFP on another platform, you're on your own — bug reports are welcome, but Linux is the only environment the project targets.

Installation

AIMFP installs three ways. On Claude Code, use the plugin (Method 1) — two commands, no manual setup. pip/manual are for other MCP clients or advanced setups.

Method 1: Claude Code Plugin (Recommended for Claude Code)

Prerequisite: uv on your PATH (a single self-contained binary). The plugin launches the MCP server with uvx, which fetches the published aimfp package from PyPI, resolves its watchdog dependency, and provisions a compatible Python (3.11+) automatically — so you don't need a matching system Python or a separate pip install.

/plugin marketplace add aryanduntley/aimfp/plugin install aimfp@aimfp

That's it — no pip install, no claude mcp add, no config files. The plugin provides:

  • the MCP server, launched via uvx aimfp==<plugin version> — each plugin release runs the matching PyPI release, which uvx caches, so the server starts offline after the first launch and moves forward when you update the plugin
  • slash commands: /aimfp:run, /aimfp:status, /aimfp:init, /aimfp:end
  • a tiny aimfp-mode setup skill + a SessionStart hook — these are setup-only: they prompt the AI to install the system prompt (via the get_system_prompt tool) and start a session. They are deliberately not a copy of the behavioral rules (that would duplicate the system prompt into every session). Your first move after install is still to ask the AI to add the AIMFP system prompt — see Add the System Prompt below; for the plugin the AI does it for you, nothing to download or paste.
  • session hooks for write-tracking nudges and an end-of-session audit guard

Updates: /plugin marketplace update aimfp. No Anthropic account, approval, or central registry is involved — the marketplace is just this public GitHub repo.

Tool pre-approval still applies to the plugin's MCP tools (named mcp__plugin_aimfp_aimfp__*; the allowlist covers both naming schemes) — see Pre-Approve All AIMFP Tools below.

Use one route per project. If a project's .mcp.json already registers an aimfp server (Method 2/3), installing the plugin starts a second AIMFP server and every tool appears twice (mcp__aimfp__* and mcp__plugin_aimfp_aimfp__*). Remove the .mcp.json entry, or don't enable the plugin in that project.

Method 2: pip install
bash
pip install aimfp

This installs the MCP server and makes the aimfp command available. AIMFP requires only one external dependency (watchdog for filesystem monitoring) — the JSON-RPC server itself is pure Python stdlib.

Method 3: Manual Install (GitHub Download)
  1. Download the repository (zip download or git clone)
  2. Locate the src/aimfp/ folder — this is the complete MCP server package
  3. Copy the aimfp/ folder to wherever you keep MCP servers:
    bash
    # Example: copy to your MCP servers directorycp -r src/aimfp/ ~/mcp-servers/aimfp/

The only runtime dependency (watchdog) is installed automatically. The aimfp/ folder contains everything else the server needs: helper functions, directives, database schemas, and the pre-populated aimfp_core.db.

Add the System Prompt (Your First Move)

Do this before anything else. The system prompt is AIMFP's record-keeping backbone — it's what tells the AI to call aimfp_run() first and run the project through AIMFP. Without it the MCP tools are just passive functions that never get called; the AI won't even know to start init or discovery.

Recommended — works for every install method, including the plugin (nothing to download or paste). Just ask the AI:

Add the AIMFP system prompt

The AI calls the get_system_prompt tool, which returns the prompt plus placement guidance, and writes it for you:

  • It goes in CLAUDE.md at your project root (Claude Code) or Settings → Custom Instructions (Claude Desktop).
  • AIMFP content is placed first — it's the project's backbone and must be the highest-priority instruction.
  • If you already have an extensive CLAUDE.md / instructions file, the AI will not blindly prepend — it reviews it with you and discusses consolidating/optimizing first. Existing content is never discarded.
  • Once it's in place, the AI offers to also set up the tool-permission allowlist — a one-time step that skips per-tool approval prompts. It only pre-approves AIMFP's own CRUD tools, which operate strictly inside .aimfp-project/: no network, no credentials, nothing outside your current project.

Manual alternative (other MCP clients, or if you'd rather paste it yourself) — print it and paste it into your client's system-prompt / custom-instructions field:

bash
python3 -m aimfp --system-prompt
AI ClientWhere the system prompt goes
Claude CodeCLAUDE.md in your project root
Claude DesktopSettings → Custom Instructions
Other MCP clientsSystem prompt / custom instructions field

Configure Your AI Client

Register the AIMFP MCP server in your AI client's configuration. The server uses stdio transport — it reads JSON-RPC messages from stdin and writes responses to stdout.

Claude Desktop

Edit claude_desktop_config.json:

json
{  "mcpServers": {    "aimfp": {      "command": "python3",      "args": ["-m", "aimfp"],      "env": {}    }  }}

If you used Method 3 (manual install), add the parent directory of your aimfp/ folder to PYTHONPATH so Python can find it:

json
{  "mcpServers": {    "aimfp": {      "command": "python3",      "args": ["-m", "aimfp"],      "env": {        "PYTHONPATH": "/path/to/parent-of-aimfp-folder"      }    }  }}

For example, if you copied aimfp/ to ~/mcp-servers/aimfp/, set PYTHONPATH to ~/mcp-servers.

If you installed into a virtual environment, use the full path to the venv's Python so Claude Desktop uses the correct interpreter:

json
{  "mcpServers": {    "aimfp": {      "command": "/path/to/venv/bin/python3",      "args": ["-m", "aimfp"],      "env": {}    }  }}
Claude Code

Use claude mcp add to register the server. Run the command from within the project folder you want AIMFP to manage.

Choose a scope first. AIMFP enforces strict functional programming and actively rejects OOP codebases. If you work on other projects that use OOP or don't need AIMFP, avoid --scope user — it enables the server in every project you open.

ScopeEffectBest for
--scope project (Recommended)Creates .mcp.json in the current directory. Shareable via git.Teams and per-project control
--scope localStored in ~/.claude.json keyed to the current directory. Private.Personal per-project use
--scope userAvailable in every project you open.Developers who use AIMFP for all projects

pip install (system-wide):

bash
claude mcp add --transport stdio --scope project aimfp -- python3 -m aimfp

pip install (virtual environment) — use the venv's Python path:

bash
claude mcp add --transport stdio --scope project aimfp -- /path/to/venv/bin/python3 -m aimfp

A bare python3 resolves to the system Python, which won't have the package. Use the full path to the venv's interpreter so the MCP server subprocess finds the installed package.

Manual install or running from source — set PYTHONPATH to the parent of the aimfp/ folder:

bash
claude mcp add --transport stdio --scope project --env PYTHONPATH=/path/to/parent-of-aimfp aimfp -- python3 -m aimfp

Quick reference:

Install MethodClaude Code Command
pip install aimfp (system)-- python3 -m aimfp
pip install aimfp (venv)-- /path/to/venv/bin/python3 -m aimfp
Manual folder / from source--env PYTHONPATH=/parent/of/aimfp -- python3 -m aimfp

Note: All flags (--transport, --scope, --env) must come before the server name. The -- separates the name from the command. Verify the server is connected with /mcp inside Claude Code.

Claude Code: Pre-Approve All AIMFP Tools (Optional)

What these tools actually do: AIMFP operates entirely inside the project you point it at. It never reads, writes, or reaches anything outside that project directory — and within it, all of its own state lives in a single .aimfp-project/ folder. The bulk of the 250+ tools are plain CRUD operations against the local SQLite database at .aimfp-project/project.db (tracking tasks, milestones, modules, and project state) plus read-only lookups of the bundled project directives. There are no network calls, no credentials, no access to your wider filesystem.

Claude Code's design prompts you to approve each MCP tool the first time it's called. With 250+ tools that's one one-time prompt per tool — tedious, but every prompt is just Claude Code confirming a local database or directive call. To skip the prompts, drop a Claude Code allowlist file (.claude/settings.local.json) into your project. This is a static Claude Code settings file that simply tells Claude Code "these tool names are pre-approved" — it is not downloaded or executed by AIMFP.

Just ask the AI to set it up:

"Set up AIMFP permissions for Claude Code"

The AI calls the get_claude_permissions tool, which returns the complete, current allowlist (generated live from the tool registry, so it can never be out of date or incomplete). The AI then writes — or, if you already have a .claude/settings.local.json, merges into — that file. Merging preserves every non-AIMFP permission and any other settings you already have; only the AIMFP entries are refreshed. Each tool is allowlisted under both names Claude Code can give it — mcp__aimfp__* (a .mcp.json server) and mcp__plugin_aimfp_aimfp__* (the plugin) — so the file is right for either install route. AIMFP itself never writes the file (it never touches anything outside the project) — the AI does, with its normal file-write confirmation. The first call to get_claude_permissions is the one prompt you approve to eliminate all the rest.

The two MCP-autostart keys (enableAllProjectMcpServers and enabledMcpjsonServers) are included automatically so the AIMFP server starts itself when you have a .mcp.json in the project.

Note: A pre-built copy of this allowlist also ships at documentation/settings.local.json if you'd rather review it directly or copy it in by hand (cp documentation/settings.local.json /path/to/your/project/.claude/). The get_claude_permissions tool is the recommended path since it's always in sync with the installed version.

Other MCP Clients

The server uses stdio transport. Point your client at python3 -m aimfp (or the full path to your venv's Python). For manual installs, ensure PYTHONPATH includes the parent directory of the aimfp/ folder. No API keys or authentication required.

How It Works

The server communicates over stdio using the Model Context Protocol. It resolves aimfp_core.db (the directive database) relative to its own installation — no environment variables needed.

Once connected, the AI calls aimfp_run() on every interaction (guided by the system prompt). Project state is stored in .aimfp-project/ in your working directory, created automatically when you initialize a project.

Project Initialization

Tell your AI assistant:

"Initialize AIMFP for my project"

The AI calls aimfp_init which creates an .aimfp-project/ folder in your project root containing databases for project state tracking, user preferences, and a ProjectBlueprint document. You don't need to interact with these files — the MCP server manages them automatically.


Directives System

FP Baseline vs FP Directives

FP Baseline (Always Active):

  • Core functional programming rules AI follows naturally when writing code
  • Pure functions, immutability, no OOP, explicit error handling
  • Non-negotiable - all code must be FP-compliant

FP Directives (Reference Documentation):

  • Detailed guidance for complex scenarios and edge cases
  • Consulted only when AI is uncertain about implementation
  • Categories: Purity, Composition, Error Handling, OOP Elimination, Optimization
  • Examples: fp_purity, fp_monadic_composition, fp_result_types, fp_wrapper_generation

Project Directives

Manage project lifecycle:

LevelDirectivesPurpose
Level 0aimfp_runGateway orchestration (every interaction)
Level 1aimfp_status, aimfp_init, project_task_decompositionStatus, initialization, high-level coordination
Level 2project_file_write, project_update_db, project_task_updateOperational execution
Level 3project_compliance_check, project_evolutionState management
Level 4project_completion_check, project_archiveValidation & completion

User Preference Directives

Manage AI behavior customization and learning:

DirectivePurpose
user_preferences_syncLoads preferences before directive execution
user_preferences_updateMaps user requests to directives, updates preferences
user_preferences_learnLearns from user corrections (requires confirmation)
user_preferences_exportExports preferences to JSON for backup/sharing
user_preferences_importImports preferences from JSON file
project_notes_logHandles logging to project.db with directive context
tracking_toggleEnables/disables tracking features with token cost warnings

User-Defined Directives

FOR USE CASE 2 ONLY: Automation projects where AIMFP generates and manages the codebase:

DirectivePurpose
user_directive_parseParse YAML/JSON/TXT directive files and extract structured directives
user_directive_validateValidate directives through interactive Q&A to resolve ambiguities
user_directive_implementGenerate FP-compliant implementation code in src/
user_directive_approveUser testing and approval workflow before activation
user_directive_activateMark directives active (does NOT deploy — your runner does)
user_directive_monitorReview health, statistics, and errors after the fact (read-only)
user_directive_updateHandle changes to directive source files (re-parse, re-validate)
user_directive_deactivateMark directives paused (does NOT stop a running process)
user_directive_statusComprehensive status reporting for all user directives

Use Cases (Automation Projects):

  • Home Automation: "At 5pm turn off living room lights", "If stove on > 20 min, turn off"
  • Cloud Infrastructure: "Scale EC2 when CPU > 80%", "Backup RDS nightly at 1am"
  • Custom Workflows: "Every Monday generate report", "Process uploaded files automatically"

Key Architecture:

  • User writes directive definitions (YAML/JSON/TXT)
  • AIMFP generates the entire automation codebase (src/, tests/, etc.)
  • AIMFP manages the generated code like any software project (tasks, files, functions)
  • AIMFP never executes a directive and never supervises the runner — the generated code owns the timer and the work; AIMFP answers "what is due" and records "what happened" through the aimfp.hooks library API
  • A dead runner is detected without any process inspection: the runner declares when it will next fire, and silence past that deadline is the evidence
  • Project.db tracks the generated code; user_directives.db tracks directive state

Key Features:

  • Write directives in YAML, JSON, or plain text
  • AI validates through interactive Q&A
  • AI generates complete FP-compliant Python modules in src/
  • AI creates tests for generated code
  • Execution driven by your own scheduler, recorded through the AIMFP hook library
  • File-based logging (30-day execution logs, 90-day error logs) written by AIMFP, so every automation project's records have the same shape
  • Health reporting at session start: overdue, skipping, degraded, never-run, or in error
  • Dependency management with user confirmation

Example Directive Definition:

yaml
# directives/home_automation.yaml (user creates this in their project)directives:  - name: turn_off_lights_5pm    trigger:      type: time      time: "17:00"      timezone: America/New_York    action:      type: api_call      api: homeassistant      endpoint: /services/light/turn_off      params:        entity_id: group.living_room_lights

User tells AI: "Parse my directive file at directives/home_automation.yaml"

AI Generates (in src/lights_controller.py):

python
# Auto-generated from home_automation.yamlfrom typing import Resultfrom homeassistant_client import HomeAssistant
def turn_off_living_room_lights(ha_client: HomeAssistant) -> Result[None, str]:    """Turn off all lights in living room group."""    # FP-compliant implementation    ...

See the directive MD files in src/aimfp/reference/directives/ for complete workflow documentation.

Git Integration

FP-powered Git collaboration for multi-user and multi-AI development:

DirectivePurpose
git_initInitialize or integrate with Git repository for version control
git_detect_external_changesDetect code modifications made outside AIMFP sessions
git_create_branchCreate user/AI work branches (aimfp-{user}-{number})
git_detect_conflictsFP-powered conflict analysis before merging
git_merge_branchMerge branches with AI-assisted conflict resolution
git_sync_stateSynchronize Git hash with project.db for external change detection

Key Features:

  • Multi-user collaboration: Multiple developers and AI instances work simultaneously
  • FP-powered conflict resolution: Uses purity levels, dependencies, and test results to auto-resolve conflicts
  • Branch naming: aimfp-alice-001, aimfp-bob-002, aimfp-ai-claude-001
  • Auto-resolution: High-confidence conflicts (>0.8) resolved automatically using FP purity rules
  • External change detection: Compares Git HEAD with stored hash to detect changes made outside AIMFP
  • Simplified schema: No separate git_state table - Git commands are fast enough (~1ms)

Why AIMFP + Git is Superior to OOP + Git:

OOP Merge ProblemAIMFP FP Solution
Class hierarchies conflict✅ No classes → No hierarchy conflicts
Hidden state changes✅ Pure functions → Explicit inputs/outputs
Side effects everywhere✅ Side effects isolated → Easy to identify conflicts
Hard to test both versions✅ Pure functions → Easy to test and compare

Example Conflict Resolution:

Alice and Bob both modify calculate_total():
Alice's version:- Purity: ✅ Pure function- Tests: 10/10 passing
Bob's version:- Purity: ✅ Pure function- Tests: 12/12 passing (includes edge cases)
AI Recommendation: Keep Bob's version (confidence: 85%)Reason: More comprehensive tests, still pure

See the Git directive MD files in src/aimfp/reference/directives/ for complete multi-user collaboration workflows.


Project Lifecycle

mermaid
graph TD    A[aimfp_init] --> B[project_discovery]    B --> C[project_progression]    C --> D[project_file_write]    D --> E[project_update_db]    E --> F{All Items Done?}    F -->|No| D    F -->|Yes| G[project_task_complete]    G --> H{All Tasks Done?}    H -->|No| C    H -->|Yes| I[project_milestone_complete]    I --> J{All Milestones Done?}    J -->|No| C    J -->|Yes| K[project_completion_check]    K --> L[project_archive]

Example Workflow

Create Project

User: "Help me build a matrix calculator"
AI → aimfp_run(is_new_session=true)    → Receives: session bundle (directive names, status, settings, supportive context)    → Checks project state: .aimfp-project/ missing → not initialized    → Calls aimfp_init helper (Phase 1: mechanical setup)        → Creates .aimfp-project/ directory        → Creates project.db, user_preferences.db        → Copies ProjectBlueprint template    → Enters Phase 2 (intelligent population)        → Detects language, build tool, source directory        → Discusses with user: project name, purpose, goals        → Updates infrastructure table and blueprint    → Routes to project_discovery        → Collaborates with user on themes, flows, completion path, milestones
AI: ✅ Project initialized: MatrixCalculator    Next: Let's define the project shape — themes, completion path, and first milestones.

Write Function

User: "Write multiply_matrices function"
AI → aimfp_run() (continuation — lightweight guidance)    → Evaluates: coding task + project tracking needed    → Has directives cached from session bundle    → Writes FP-compliant function naturally (pure, immutable, no OOP)    → Follows project_file_write directive workflow:        → Reserves file and function IDs in project.db        → Writes src/matrix.py with embedded IDs        → Finalizes file and function entries        → Updates project.db:           • files table (new entry)           • functions table (multiply_matrices)           • interactions table (dependencies)
AI: ✅ Function written: multiply_matrices    File: src/matrix.py:15    DB Updated: ✓ files, functions, interactions    Dependencies: validate_dimensions

Check Compliance

User: "Check project compliance"
AI → aimfp_run() (continuation — lightweight guidance)    → project_compliance_check directive (opt-in tracking feature)    → Queries all functions from project.db    → Reviews each function against FP baseline    → Generates analytics report
AI: 📊 Compliance Report:    Total functions: 12    Compliant: 10    Violations: 2      - calculate_discount (uses global config)      - process_order (hidden mutation)

Customize AI Behavior

User: "Always add docstrings to functions"
AI → aimfp_run() (continuation — lightweight guidance)    → user_preferences_update directive        → Calls find_directive_by_intent helper        → Searches directives by name/description/keywords        → Finds match: project_file_write        → Confirms with user: "Apply to file writing?"        → Updates user_preferences.db
AI: ✅ Preference saved: project_file_write    Key: always_add_docstrings    Value: true
    Next file write will include docstrings automatically.

AI Learns from Corrections

User: "Actually, use guard clauses instead of nested if statements"
AI → user_preferences_learn directive (detects correction)    → Logs interaction to ai_interaction_log    → Infers preference: prefer_guard_clauses = true    → Prompts user: "Should I remember this preference?"
User: "Yes"
AI: ✅ Preference learned: project_file_write    Key: prefer_guard_clauses    Value: true
    I'll use guard clauses in future functions.

Documentation

Directive Reference

All directive documentation is shipped with the package at src/aimfp/reference/directives/ — 131 MD files covering every directive. Each file includes: purpose, when to apply, complete workflows (trunk → branches), compliant/non-compliant examples, edge cases, related directives, helper functions used, and database operations.

Database Schemas

Schema SQL files are in the package at src/aimfp/database/schemas/:

  • aimfp_core.sql — Global read-only database (directives, helpers, flows)
  • project.sql — Per-project mutable database (files, functions, tasks, milestones)
  • user_preferences.sql — Per-project user customization database
  • user_directives.sql — Per-project automation directives (Use Case 2 only)

Development

Dev Directory (dev/)

The dev/ directory contains the source of truth for directive and helper function definitions. These JSON files are the canonical definitions that get imported into aimfp_core.db before release.

dev/├── directives-json/              # Directive definitions (source of truth)│   ├── directives-fp-core.json   # Core FP directives│   ├── directives-fp-aux.json    # Auxiliary FP directives│   ├── directives-project.json   # Project lifecycle directives│   ├── directives-user-pref.json # User preference directives│   ├── directives-user-system.json # User automation directives│   ├── directives-git.json       # Git collaboration directives│   ├── directive_flow_fp.json    # FP directive flow transitions│   ├── directive_flow_project.json # Project directive flow transitions│   └── directive_flow_user_preferences.json # User pref flow transitions├── helpers-json/                 # Helper function definitions (source of truth)│   ├── helpers-core.json         # Core/directive helpers│   ├── helpers-orchestrators.json # Entry point and status helpers│   ├── helpers-project-*.json    # Project management helpers (9 numbered files)│   ├── helpers-project-modules.json    # Module helpers│   ├── helpers-project-task-files.json # Task-file link helpers│   ├── helpers-catalog.json      # Existing-codebase adoption helpers│   ├── helpers-changeset.json    # Semantic changeset merge helpers│   ├── helpers-backup.json       # Backup helpers│   ├── helpers-notices.json      # One-time release notice helpers│   ├── helpers-settings.json     # User preference helpers│   ├── helpers-user-custom.json  # User directive helpers│   ├── helpers-git.json          # Git operation helpers│   └── helpers-index.json        # Shared/global helpers├── notices-json/notices.json     # One-time release notices (synced into aimfp_core.db)├── sync-directives.py            # Imports JSON → aimfp_core.db├── bump-version.py               # Syncs the package version across the files below└── logs/                         # Development logs

Dev workflow: Modify JSON files in dev/ → delete src/aimfp/database/aimfp_core.db and run sync-directives.py to rebuild it → test → release. End users only interact with the pre-populated aimfp_core.db, never the JSON files directly.

Version Locations

All four must be kept in sync when bumping versions (python3 dev/bump-version.py does this):

FileVariablePurpose
pyproject.tomlversion = "X.Y.Z"Package version (PyPI, pip install)
src/aimfp/__init__.py__version__ = "X.Y.Z"Runtime version (import aimfp; aimfp.__version__)
src/aimfp/mcp_server/server.pySERVER_VERSION = "X.Y.Z"MCP initialize handshake response (serverInfo.version)
.claude-plugin/plugin.json"version": "X.Y.Z"Claude Code plugin version

Design Philosophy

Immutable Rules, Evolving Projects

  • aimfp_core.db is the rulebook (read-only, global, version-controlled)
  • project.db is the workspace (read-write, per-project, runtime state)
  • user_preferences.db is the customization layer (read-write, per-project, AI behavior)
  • Directives define the boundaries; AI operates freely within them

Database-Driven Context

Traditional AI assistants lack persistent memory. AIMFP solves this:

-- AI remembers everything across sessions via helper toolsAI calls: get_project_status("detailed")→ Returns: project metadata, active milestone, current task, recent notes, tracked files and functions
-- No source code reparsing required. Instant context retrieval.

Finite by Design

Every AIMFP project has a completion path:

Setup → Core Development → Testing → Documentation → Finalization

Once project_completion_check passes, the project is done. No endless feature creep.


Features

  • Comprehensive MCP tools — Full CRUD for 4 SQLite databases, covering project management, FP directives, user preferences, and custom automation directives
  • Pure functional enforcement — AI writes FP-compliant code by default (pure functions, immutability, no OOP)
  • Database-driven persistent memory — Project state survives across sessions; no context loss
  • Directive-based workflows — Deterministic trunk → branches → fallback execution patterns
  • Finite completion paths — Projects have defined stages, milestones, and tasks; work converges toward completion
  • Two use cases — Regular software development (Use Case 1) or custom directive automation (Use Case 2)
  • User preference learning — AI adapts to coding style via per-directive key-value overrides
  • Git integration — FP-powered branch management and conflict resolution
  • Minimal dependencies — One runtime package (watchdog), custom JSON-RPC server uses stdlib only
  • Cost-conscious design — All tracking/analytics features disabled by default

Token Overhead

AIMFP's project management adds token overhead to each session. Database operations (tracking files, updating tasks, managing milestones) consume tokens beyond the code-writing itself. We work to minimize this — continuation calls are lightweight (~2k tokens), batch helpers reduce round-trips, and all optional tracking is off by default.

The payoff comes with project scale. Without AIMFP, every new session requires the AI to re-scan directories, re-read source files, and rebuild context from scratch — costs that grow with codebase size. With AIMFP, the database provides instant structured context: the AI knows exactly which files exist, what functions they contain, where work left off, and what comes next. For projects beyond a handful of files, the up-front tracking cost is recovered many times over through eliminated re-discovery work.


Usage Examples

Example 1: Project Initialization

User prompt: "Help me build a calculator"

Tool calls:

1. aimfp_run(is_new_session=true)   → Returns: session bundle (directive names, settings, project status, supportive context)   → Status shows: .aimfp-project/ missing — not initialized
2. aimfp_init(project_root="/home/user/calculator")   → Returns: { success: true, message: "Project initialized" }

What happens:

  • AI detects no project exists and automatically calls aimfp_init helper
  • Creates .aimfp-project/ directory with project.db, user_preferences.db, and ProjectBlueprint.md
  • Registers project metadata (name, root path, infrastructure)
  • Inserts default user settings and backup configuration
  • AI enters Phase 2: discusses project shape with user (infrastructure, purpose, goals)
  • Routes to project_discovery for collaborative planning (themes, flows, completion path, milestones)

Example 2: Writing FP-Compliant Code

User prompt: "Write a multiply_matrices function"

Tool calls:

1. aimfp_run(is_new_session=false)   → Returns: lightweight guidance
2. reserve_file(name="matrix_operations", path="src/matrix_operations.py", language="Python")   → Returns: { success: true, id: 42 }
3. reserve_function(name="multiply_matrices", file_id=42, purpose="Multiply two matrices")   → Returns: { success: true, id: 99 }
   (AI writes FP-compliant code to src/matrix_operations_id_42.py)
4. finalize_file(file_id=42, path="src/matrix_operations_id_42.py", ...)   → Returns: { success: true }
5. finalize_function(function_id=99, name="multiply_matrices_id_99", file_id=42, purpose="...", parameters=[...], returns={...})   → Returns: { success: true }

What happens:

  • File and function are reserved in project.db before writing (IDs embedded in names)
  • AI writes pure functional code following FP baseline (no OOP, no mutations, explicit parameters)
  • File and function are finalized with purpose, parameters, and return metadata
  • Project database now tracks the code structure for instant retrieval in future sessions

Example 3: Resuming Work / Checking Status

User prompt: "Where are we?" or "Continue working"

Tool calls:

1. aimfp_run(is_new_session=false)   → Returns: guidance + common starting points
   (AI answers from cached context — no additional DB calls needed    unless context is stale, in which case:)
2. aimfp_status(type="detailed")   → Returns: project metadata, active milestone, current task, recent notes, warnings

What happens:

  • AI presents current milestone, active task, and next steps
  • If project_continue_on_start=true, AI automatically picks up the next task
  • No source code reparsing needed — everything is indexed in project.db

Privacy Policy

AIMFP runs entirely on your local machine. No data ever leaves your computer.

  • No network requests: The MCP server makes zero network calls. All operations are local SQLite database reads/writes and filesystem operations.
  • No telemetry: No usage analytics, crash reports, or diagnostic data is collected or transmitted.
  • No third-party services: AIMFP does not connect to any external APIs, cloud services, or remote servers.
  • Local data only: All project data (databases, preferences, directives) is stored in your project's .aimfp-project/ directory. You own and control all data.
  • No Claude memory access: AIMFP does not access or read Claude's conversation history, memory, or any other client-side data.

If you have questions about data handling, please open an issue on our GitHub repository.


Support


Contributing

AIMFP is an open standard for AI-optimized programming. Contributions welcome:

  1. New FP directives — Language-specific or advanced patterns
  2. Helper functions — Database, file, Git, or FP utilities
  3. Templates — ADT boilerplate, error handling patterns
  4. Documentation — Examples, tutorials, case studies

By submitting a contribution (pull request, patch, or other material), you agree that it may be distributed under the PolyForm Noncommercial License 1.0.0 and under any commercial license the copyright holder grants for AIMFP, and you confirm you have the right to make that grant.


License

AIMFP is licensed under the PolyForm Noncommercial License 1.0.0. See LICENSE for the full terms.

Free for noncommercial use: personal study, research, experimentation, hobby projects, and use by charitable organizations, educational institutions, public research organizations, and government institutions.

Commercial use requires written approval. This covers any for-profit use, including use by or for a business, use in paid or client work, selling or redistributing AIMFP or a derivative of it, and offering it as part of a paid product or service. To request a commercial license, contact Aryan Duntley at [email protected].

Versions up to and including 1.66.1 were released under the MIT License, and copies of those versions remain under MIT. Every later version is licensed only under the PolyForm Noncommercial License 1.0.0.


Summary

AIMFP transforms AI from a "code generator" into a structured, customizable project collaborator.

It combines:

  • Pure functional programming for deterministic, composable code
  • Four-database architecture for immutable rules, runtime state, user customization, and optional automation
  • Directive-based workflows for consistent, automated compliance
  • User preference learning for AI that adapts to your coding style
  • Finite completion paths for goal-oriented development
  • Cost-conscious design with opt-in tracking features

The result: AI-maintained codebases that are predictable, traceable, customizable, and maintainable across sessions, teams, and even different AI assistants.


Built for the age of AI-native development.

Source: README.md at commit b220716

Tools

200

acknowledge_notice

Acknowledge Notice

Mark a notice as delivered so it never fires again for this project. Writes to acknowledged_notices in user_preferences.db; the notice text itself lives in the read-only core database and is untouched. Call only AFTER acting on the notice — for an action_required notice that means after the user has actually answered, not merely been asked.

Parametersoutcomenotice_keyrequired

activate_user_directive

Activate User Directive

Set directive status to 'active' and record activated_at timestamp, only for a directive a person approved and that is unchanged since (approval content hash). Does NOT deploy services - AI handles deployment via directive workflow.

Parametersdirective_idrequired

add_completion_path

Add Completion Path

Add completion path stage

Parametersnamerequiredstatustheme_idsdescriptionorder_index

add_directive_preference

Add Directive Preference

Add/update user preference for directive

Parametersactivedescriptiondirective_namerequiredpreference_keyrequiredpreference_valuerequired

add_file_flows

Add File Flows

Batch-assign multiple files to flows. Skips existing links silently. More efficient than multiple add_file_to_flow calls.

Parameterslinksrequired

add_file_to_flow

Add File To Flow

Assign a finalized file to an architectural flow. Every finalized file needs at least one flow assignment to stay architecturally connected.

Parametersfile_idrequiredflow_idrequired

add_file_to_module

Add File To Module

Assign a file to a module. Creates module_files junction entry. Same pattern as add_file_to_flow.

Parametersfile_idrequiredmodule_idrequired

add_files_to_module

Add Files To Module

Batch assign multiple files to modules. More efficient than multiple add_file_to_module calls. Skips duplicates silently, fails fast on missing entities.

Parameterslinksrequired

add_flow

Add Flow

Add a project flow (evolving behaviour/architecture description) linked to at least one theme. theme_ids is required: a flow never exists without a theme.

Parametersnamerequiredtheme_idsrequireddescriptionai_generatedconfidence_score

add_flow_themes

Add Flow Themes

Batch-link flows to themes (flow_themes). Every flow must belong to at least one theme; use this to fix theme-less flows or give a flow a second theme.

Parameterslinksrequired

add_interaction

Add Interaction

Record a dependency between two functions by name (call, chain, borrow, compose, pipe). Interactions are how the AI traces dependency graphs. An edge already tracked is not duplicated (already_existed=true).

Parameterssourcerequiredtargetrequireddescriptionis_indirectinteraction_typerequired

add_interactions

Add Interactions

Batch-record function dependencies by ID. More efficient than multiple add_interaction calls for tracking all cross-function dependencies. Edges already tracked (same source, target, type) are skipped and counted in skipped_count; ids stay in input order.

Parametersinteractionsrequired

add_item

Add Item

Create a single work item under a task, subtask, or sidequest. Items are the smallest trackable units of work.

Parametersnamerequiredstatusdescriptionreference_idrequiredreference_tablerequired

add_items

Add Items

Batch-create multiple work items under a single parent in one call. All items created with status 'pending'.

Parametersitemsrequiredreference_idrequiredreference_tablerequired

add_milestone

Add Milestone

Add milestone to completion path

Parametersnamerequiredstatusflow_idsdescriptioncompletion_path_idrequired

add_milestone_flows

Add Milestone Flows

Batch-link milestones to the flows (evolving behaviour) they build or change (milestone_flows). A milestone that introduces new behaviour should get a NEW flow (add_flow) rather than growing an existing flow's description.

Parameterslinksrequired

add_module

Add Module

Create a new module (reusable code boundary). A module maps to a directory. Files are assigned explicitly via add_file_to_module. Use external_dependencies to record wrapped libraries.

Parametersnamerequiredpathrequiredpurposedescriptionexternal_dependencies

add_note

Add Note

Record a decision, architecture change, or context event in the project's audit trail. Supports typed notes with optional directive linking.

Parameterssourcecontentrequiredseveritynote_typerequiredreference_iddirective_namereference_tablesend_with_directive

add_path_themes

Add Path Themes

Batch-link completion paths to the themes (stable project areas) they advance (completion_path_themes). Themes change rarely, like paths.

Parameterslinksrequired

add_project_entry

Add Project Entry

Add new entry to project database

Parametersdatarequiredtablerequired

add_settings_entry

Add Settings Entry

Add entry to user settings database

Parametersdatarequiredtablerequired

add_sidequest

Add Sidequest

Create an urgent interruption that pauses the current task. Use for bug fixes, blockers, or unexpected work discovered mid-task.

Parametersnamerequiredstatusflow_idsprioritydescriptionpaused_task_idrequiredpaused_subtask_id

add_subtask

Add Subtask

Create a focused sub-unit of work under a parent task. The parent is paused until all subtasks complete.

Parametersnamerequiredstatusprioritydescriptionparent_task_idrequired

add_task

Add Task

Create a task under a milestone with flow associations. Tasks are created ONE at a time as work progresses, not all at once.

Parametersnamerequiredstatusflow_idsprioritydescriptionmilestone_idrequired

add_theme

Add Theme

Add project theme

Parametersnamerequireddescriptionai_generatedconfidence_score

add_tracking_note

Add Tracking Note

Add tracking note to user_preferences.db (only when tracking enabled)

Parameterscontentrequiredseveritynote_typerequiredreference_idmetadata_jsondirective_namereference_namereference_type

add_types_functions

Add Types Functions

Link tracked types to the functions that use them with a role (factory, transformer, validator, etc.). Enables 'what functions use TypeX?' queries. Links already tracked are skipped and counted in skipped_count instead of failing the batch.

Parametersrelationshipsrequired

add_user_custom_entry

Add User Custom Entry

Add entry to user_directives.db table. Returns inserted record with ID. Every key must be a column of the table; on user_directives the approval columns and status='active' are refused, so a new directive always starts unapproved.

Parametersdatarequiredtablerequired

add_user_directive_note

Add User Directive Note

Add note to user_directives.db notes table for AI record-keeping

Parameterscontentrequiredseveritynote_typerequiredreference_idmetadata_jsonreference_namereference_type

add_user_setting

Add User Setting

Add new project-wide user setting to user_settings table

Parametersscopedescriptionsetting_keyrequiredsetting_valuerequired

aimfp_end

Aimfp End

Session termination orchestrator. Gathers session audit data: reads watchdog state and final reminders, queries all files and functions from DB for AI to cross-reference, reads recent notes and task state. Stops watchdog process if running. Returns structured audit data for AI to interpret and act on. No analysis logic — AI determines what is stale or missing. Also runs the tracking audit (functions, interactions, descriptions) over the session's uncommitted changes (or the in-progress work item's files without git) and returns data.audit with counts, verdict and report_path.

Takes no parameters.

aimfp_init

Aimfp Init

Phase 1 mechanical setup orchestrator for project initialization. Atomically creates directories, databases with schemas, and templates. No deep logic - pure mechanical operations.

Parametersproject_rootrequired

aimfp_run

Aimfp Run

Main entry point orchestrator. Called on session start (is_new_session=true) for full context bundle, and at work checkpoints (is_new_session=false) for watchdog alerts only.

Parametersis_new_session

aimfp_status

Aimfp Status

Project status in three tiers. Default 'quick' is the cheap position check for completion loops; 'summary' is the reload after lost or compacted context. Structure (themes/flows/modules) is attached to the work and files shown, never listed whole.

Parameterstype

apply_audit_fixes

Apply Audit Fixes

Apply audit findings in ONE call and ONE transaction, with a restore manifest written in the same transaction. Name report categories (report + apply) so thousands of IDs never pass through the conversation, hold back reviewed false positives for this call with exclude={category: [ids]} or for good with exempt=[...], and/or pass explicit changes. Every report finding is re-checked against its row first: an edge whose endpoints changed since the audit, or an entity already gone or renamed, is skipped with a reason. One entry_deletion note lists every deleted row (cascaded edges and type links included) and the old values of every changed row, so any change can be undone. Judgement categories (unconfirmed_interactions, dangling_mentions, missing_functions, untracked_files) are refused: they need prose, a mark, or reconcile_paths. Description review lists (unbaselined_needs_review, stale_descriptions) apply as baselines once reviewed: exclude the ones whose prose you are rewriting.

Parametersapplyexemptreasonrequiredreportcleanupdry_runexcludeunexempt_idsadd_type_linksdelete_type_idsadd_interactionsmark_indirect_ids+6 more

apply_state_changeset

Apply State Changeset

(For use with InterCommAIMFP) Apply a semantic changeset onto the current-main project.db as a 3-way merge (base@base_main_commit vs branch intent vs current main). Accepts EITHER the inline changeset object OR a changeset_id handle (loaded server-side). Auto-applies non-overlapping changes, mints canonical IDs for genuinely new entities, rewrites all references to canonical IDs, and returns EVERY conflict as structured data for the master/AI to review — it never guesses on a conflict. Mutates the working .aimfp-project/project.db in place after taking a backup; a genuine failure rolls back and restores the backup.

Parameterschangesetchangeset_id

audit_descriptions

Audit Descriptions

Audit function and type descriptions for drift from the code. Read-only. stale_descriptions: the function's code changed after its purpose/parameters/returns were written (functions.source_hash, recorded on every prose write, differs from the current code hash; formatting, comments and docstrings never change the hash). dangling_mentions: a description names a callable that exists nowhere — 'name()' or 'snake_name(...)' not defined, imported or called anywhere in the tracked Python files, not tracked, not a builtin or Python keyword, and not vocabulary the code writes in its string literals (a whole-string identifier or 'name(' in a string: DSL built-ins such as jsonencode, parse_json); attribute calls, ALLCAPS and 'file(s)' plurals are ignored. Described functions with no hash yet are triaged against the code: unbaselined_descriptions (info) pass and can be baselined in one call; unbaselined_needs_review (info) carry triage reasons (recorded parameter names or return type differing from the code, a purpose under three words, snake_case/backticked names in the prose that neither the function nor the rest of its file uses — names, imports, string words, plural or singular forms count), the recorded prose and a code excerpt; a name found nowhere in the repo (any file under the project root the exclusion stack keeps) ranks priority 'high' with signature mismatches, one found elsewhere ranks 'low', and lists are sorted high first. stale_descriptions carry the same triage, priority and excerpt. Warnings only — never blocks a task. Scope selectors combine as a union; with none, the whole project (tracked files plus untracked source files) is audited. Writes the full report to <project folder>/audit/ and returns counts + samples + report_path.

Parameterspathstask_idfile_idstask_typemodule_pathsince_commit

audit_functions

Audit Functions

Audit tracked files, functions and types against the source. Read-only. Python files (full fidelity): missing_functions (public, untracked), stale_functions (tracked, gone from the source; a module-level `f = partial(...)`, lambda or alias binding of the name counts as defined), incomplete_functions (purpose/parameters/returns empty), malformed_json (not one JSON encoding of a list/object; double-encoded is fixable), reserved_functions (never finalized), param_mismatch (recorded parameters vs the signature: names, order, required vs default), missing_types, stale_types (name defined nowhere in the file), incomplete_types, missing_type_links (a tracked type named in a signature with no types_functions link, role suggested), files_without_functions (informational). Every file: missing_files (tracked, gone from disk), untracked_files. Regex languages only report names_only_missing (warning) and never claim anything stale. Tracking _private functions is optional: untracked ones are never reported, tracked ones get every check. Scope selectors combine as a union; with none, the whole project (tracked files plus untracked source files) is audited. Writes the full report to <project folder>/audit/ and returns counts + samples + report_path.

Parameterspathstask_idfile_idstask_typemodule_pathsince_commit

audit_interactions

Audit Interactions

Audit tracked interactions against the call graph the code makes, for the callers in scope. Read-only. Expected edges: calls AND functions used as values (map(fn, xs), partial, dispatch dicts built in the body), credited through untracked same-file helpers, resolved through imports, aliases and re-exports. Categories: missing_interactions (code makes it, DB lacks it), stale_interactions (provably gone: every use of the target's name in the caller resolves to something else — another function, a local or loop variable, a method on a value — or there is none), repoint_interactions (a stale edge that is the same dependency moved: call moved to another function in the same file, or target moved under the same name — one change, not delete+add), unconfirmed_interactions (may be real but unprovable, each with a reason: name resolves ambiguously, called through a record field or factory several functions are stored under, a callback parameter of the target's name, the name as a string in a lookup position (call argument such as getattr's, subscript key, list/tuple/set element; never a dict-literal key, comparison or assignment), a non-Python target: mark indirect or delete), indirect_interactions (is_indirect edges) and non_call_interactions (chain/compose/pipe/borrow types): informational, never flagged. Confirmed without being expected (never reported, never asked to be added): self-recursion, functions held in a module-level table the caller reads (dispatch), a .field() call when the target is the only tracked function stored under that field anywhere (Rec(field=target)), a non-Python function called as name( in the caller's string literals (SQL). Python callers only (full fidelity); other files listed in unchecked_files. Scope selectors combine as a union; with none, the whole project (tracked files plus untracked source files) is audited. Writes the full report to <project folder>/audit/ and returns counts + samples + report_path.

Parameterspathstask_idfile_idstask_typemodule_pathsince_commit

audit_tracking

Audit Tracking

Run EVERY tracking audit over one scope with one code index and one report: files, functions, types, parameters, JSON encoding, type links (audit_functions), interactions with repoints (audit_interactions), stale prose and dangling mentions (audit_descriptions), plus modularity gaps (structure_gaps). Read-only. The same audit gates task/subtask/sidequest completion (over the item's linked files), runs in aimfp_end over uncommitted work, runs per changed file in the watchdog, and runs in CI as `aimfp audit`. Scope selectors combine as a union; with none, the whole project (tracked files plus untracked source files) is audited. Writes the full report to <project folder>/audit/ and returns counts + samples + block/warn verdict + report_path.

Parametersfullpathsincludetask_idfile_idstask_typemodule_pathsample_limitsince_commit

backfill_semantic_keys

Backfill Semantic Keys

(For use with InterCommAIMFP) Mint stable identity keys for any rows that lack one: slugs on work-hierarchy rows (milestones, tasks, subtasks, sidequests, items) and entity_key on functions/types — e.g. rows that predate those columns. OPTIONAL one-time prep: run once on main (and commit) only when a pre-v1.11 project is about to start multi-agent parallel work, so every clone inherits stable baseline keys that export_state_changeset can match. Unnecessary for solo projects (keys never read) and for projects started fresh on v1.11+ (keys minted at creation — no-op). Idempotent.

Takes no parameters.

batch_update_progress

Batch Update Progress

Update multiple project items atomically. Used after code generation or bulk operations to ensure consistency.

Parametersupdatesrequiredtransactioncontinue_on_error

blueprint_has_changed

Blueprint Has Changed

Check if ProjectBlueprint.md has changed using Git or filesystem timestamp

Parametersblueprint_pathrequired

catalog_files

Catalog Files

Register existing files in project.db in a single phase. For code already on disk: rows are written finalized (is_reserved=0) with ID naming off, because existing filenames are fixed and cannot carry an _id_ suffix. Use INSTEAD OF reserve_files/finalize_files when adopting an existing codebase. Idempotent on path; re-cataloging keeps a stored name or language that is omitted.

Parametersfilesrequired

catalog_functions

Catalog Functions

Register existing functions in project.db in a single phase. Use INSTEAD OF reserve_functions/finalize_functions when adopting an existing codebase. Idempotent on (file_id, name), so a re-scan after source changes refreshes signatures instead of duplicating them. Only supplied fields are overwritten: an omitted or blank purpose, parameters or returns keeps the stored value, so a refresh never erases prose.

Parametersfunctionsrequired

catalog_types

Catalog Types

Register existing type definitions in project.db in a single phase. Use INSTEAD OF reserve_types/finalize_types when adopting an existing codebase. Idempotent on (file_id, name); definition is always refreshed, an omitted description keeps the stored one.

Parameterstypesrequired

check_directive_health

Check Directive Health

Assess every user directive and report which need attention. The health states, in the order they are checked: 'unapproved' (status is active but no person approved it, so dispatch withholds it); 'needs_reapproval' (approved, but the trigger, action or implementation file changed since, or it was approved before schema 1.5 without a content hash; dispatch and activation refuse it until the user approves again); 'error' (the directive's own status is error); 'overdue' (next_scheduled_time is in the past, meaning the runner said when it would next fire and did not); 'skipping' (consecutive_skip_count is at or above skip_threshold with no run since the last skip, meaning the runner is alive but keeps skipping occurrences, usually because the host is down at the scheduled time); 'degraded' (error rate at or above the threshold); 'never_run' (active but never executed; when dispatch errors exist, the detail says the runner is running but refusing or failing to dispatch, otherwise that the runner may not be deployed); or 'ok'. Returns a verdict per directive with a one-line explanation and the skip fields, plus a count per state, designed to render as a single sentence at session start.

Parametersproject_rootskip_thresholderror_rate_threshold

check_scheduled_backup_due

Check Scheduled Backup Due

Check whether a scheduled backup is overdue, measured from the LAST BACKUP. Distinct from the inactivity rule (backup_duration), which measures time since the last project change and therefore only ever fires on dormant projects — an actively developed project would otherwise never be backed up. Governed by backup_interval_days; 0 disables scheduling. Called automatically by aimfp_run(is_new_session=true); available standalone for hosts that want the check on demand.

Takes no parameters.

clear_watchdog

Clear Watchdog

Clear watchdog reminders after they have been reviewed and handled. Reminders persist in .aimfp-project/watchdog/reminders.json until this is called. Call after addressing all watchdog findings (file deletions, unregistered files, etc.).

Takes no parameters.

core_allowed_check_constraints

Core Allowed Check Constraints

Returns list of allowed values for CHECK constraint enum fields in aimfp_core.db. Parses schema to extract CHECK(field IN (...)) constraints.

Parametersfieldrequiredtablerequired

create_project

Create Project

Initialize project entry (one per database)

Parametersnamerequiredgoalsrequiredstatuspurposerequiredversionuser_directives_status

create_project_backup

Create Project Backup

Create a backup of .aimfp-project/ right now, ignoring any threshold. Zips everything except backups/ and watchdog/, adds a generated backup_summary.md, and rotates old archives per the backup_count setting, naming every archive it deletes (rotated, plus a warning sentence). The on-demand counterpart to the automatic inactivity check — call this when aimfp_run reports a scheduled backup due, or before any risky operation.

Takes no parameters.

create_state_database

Create State Database

Create per-project state database (.state/runtime.db) from SQL schema. FP-compliant replacement for mutable global variables.

Parameterssource_directoryrequired

create_user_branch

Create User Branch

Create work branch following aimfp-{user}-{number} convention

Parametersuserrequiredpurposerequired

deactivate_user_directive

Deactivate User Directive

Set directive status to 'paused'. Does NOT stop services - AI handles service shutdown via directive workflow.

Parametersdirective_idrequired

delete_completion_path

Delete Completion Path

Delete completion path with milestone validation

Parametersidrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_custom_return_statement

Delete Custom Return Statement

Delete custom return statement(s) for a helper function. By ID, by text, or all for a helper.

Parametersstatementhelper_namerequiredstatement_id

delete_file

Delete File

Delete file with comprehensive cross-reference validation

Parametersfile_idrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_flow

Delete Flow

Delete flow with file validation

Parametersflow_idrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_function

Delete Function

Delete a function, deciding explicitly what happens to its interactions: refused (with the edges listed) unless repoint_to moves them to the function that took over its job, or confirm_cascade removes them. Every moved or removed edge is recorded in the deletion note so it can be undone. Type relationships must be unlinked first.

Parametersnote_typerepoint_tofunction_idrequirednote_reasonrequirednote_sourcerequirednote_severityrequiredconfirm_cascade

delete_interaction

Delete Interaction

Delete interaction

Parametersnote_typenote_reasonrequirednote_sourcerequirednote_severityrequiredinteraction_idrequired

delete_item

Delete Item

Delete item with status validation

Parametersidrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_milestone

Delete Milestone

Delete milestone with task validation

Parametersidrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_module

Delete Module

Delete a module. CASCADE removes module_files junction entries. Files themselves are NOT deleted.

Parametersmodule_idrequired

delete_note

Delete Note

Delete note (discouraged)

Parametersidrequired

delete_project_entry

Delete Project Entry

Smart delete with automatic routing to specialized functions when needed

Parametersidrequiredtablerequirednote_typerequirednote_reasonrequirednote_sourcerequirednote_severityrequired

delete_reserved

Delete Reserved

Delete abandoned reserved entries (escape hatch for cancelled reserve operations)

Parametersidrequiredtablerequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_settings_entry

Delete Settings Entry

Delete entry from user_preferences.db table

Parameterstablerequiredrecord_idrequired

delete_sidequest

Delete Sidequest

Delete sidequest with item validation (same logic as delete_task)

Parametersidrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_subtask

Delete Subtask

Delete subtask with item validation (same logic as delete_task)

Parametersidrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_task

Delete Task

Delete task with item validation

Parametersidrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_theme

Delete Theme

Delete theme with flow validation

Parameterstheme_idrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_type

Delete Type

Delete type with relationship validation

Parameterstype_idrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_type_function

Delete Type Function

Remove type-function relationship

Parametersidrequirednote_typenote_reasonrequirednote_sourcerequirednote_severityrequired

delete_user_custom_entry

Delete User Custom Entry

Delete entry from user_directives.db table, writing an entry_deletion note in the same transaction

Parameterstablerequiredrecord_idrequirednote_reasonnote_source

detect_conflicts_before_merge

Detect Conflicts Before Merge

Dry-run merge analysis - retrieves potential conflict data for AI to evaluate

Parameterssource_branchrequired

detect_external_changes

Detect External Changes

Compare current Git HEAD with project.last_known_git_hash

Takes no parameters.

detect_state_conflicts

Detect State Conflicts

(For use with InterCommAIMFP) OPTIONAL pre-apply planning aid: export each pending worker branch and report where two or more branches touch the SAME semantic entity or edge, so the master can re-partition or deliberately order integration BEFORE applying any changeset. Pure read (built entirely from export_state_changeset). An overlap is a heuristic warning, not a verdict — the authoritative 3-way resolution still happens in apply_state_changeset.

Parametersbranchesrequired

execute_merge

Execute Merge

Execute git merge and return result. Updates work_branches table on success.

Parameterssource_branchrequired

export_state_changeset

Export State Changeset

(For use with InterCommAIMFP) Export a semantic changeset of project.db between two committed git states (branch point -> branch tip), expressed entirely in stable semantic keys (file path, file+function/type name, module/theme/flow/path name, and work-hierarchy slugs) with branch-local integer PKs stripped. Each entity is classified add/modify/delete and each edge add/remove. This is the integer-free artifact the master applies to merge a worker's project-state into main without binary-blob conflicts or PK collisions. The changeset is ALSO persisted server-side under .aimfp-project/changesets/ and a small changeset_id handle + counts summary are returned, so the master can drive apply by handle instead of re-transcribing the full object. Pure read of git blobs (the export itself never mutates project.db); persistence writes only a JSON file under .aimfp-project/.

Parametersbranchrequiredworker_idbase_commitrequired

file_has_changed

File Has Changed

Check if file changed using Git (if available) or filesystem timestamp

Parametersfile_idrequired

finalize_file

Finalize File

Mark a reserved file as tracked after writing it to disk. The path must be a regular file relative to the project root: '.', a directory, or a path leaving the project is refused. Triggers flow assignment and function/type tracking checks.

Parametersnamerequiredpathrequiredfile_idrequiredlanguagerequiredskip_id_naming

finalize_files

Finalize Files

Batch-finalize multiple reserved files after writing them to disk. All-or-nothing operation. Each path must be a regular file relative to the project root ('.' or a directory is refused).

Parametersfilesrequired

finalize_function

Finalize Function

Mark a reserved function as tracked after writing it. Triggers interaction and type-function relationship checks.

Parametersnamerequiredfile_idrequiredpurposereturnsparametersfunction_idrequiredskip_id_naming

finalize_functions

Finalize Functions

Batch-finalize multiple reserved functions after writing them. Triggers interaction and type-function checks for all.

Parametersfunctionsrequired

finalize_type

Finalize Type

Finalize reserved type after creation

Parametersnamerequiredlinksfile_idtype_idrequireddescriptionskip_id_namingdefinition_jsonrequired

finalize_types

Finalize Types

Finalize multiple reserved types

Parameterstypesrequired

find_directive_by_intent

Find Directive By Intent

Match a natural-language user request to the most relevant directive(s). Use when the user describes what they want and you need to find which directive handles it.

Parametersthresholduser_requestrequired

find_directives_by_intent_keyword

Find Directives By Intent Keyword

Find directive IDs matching one or more intent keywords (direct keyword lookup)

Parameterskeywordsrequiredmatch_mode

get_active_user_directives

Get Active User Directives

Get all user directives with status='active'. Convenience query for checking active directive count.

Takes no parameters.

get_all_completion_paths

Get All Completion Paths

Get the project's ordered completion roadmap (stages from setup through completion). Each path contains milestones which contain tasks.

Takes no parameters.

get_all_directive_keywords

Get All Directive Keywords

Get list of all unique intent keywords available for searching (simple list)

Takes no parameters.

get_all_directive_names

Get All Directive Names

Get list of all directive names (or filtered by types). Returns names only, NOT full directive data. AI queries by name when needs details.

Parameterstypes

get_all_directives

Get All Directives

Load all directives for caching (special orchestrator)

Takes no parameters.

get_all_flows

Get All Flows

Get project flows (architectural groupings describing intended behavior): all of them, or the ones in flow_ids. Lean by default (descriptions null); detail_level='full' for descriptions. Check BEFORE starting any task to understand the architecture.

Parametersflow_idsdetail_level

get_all_infrastructure

Get All Infrastructure

Get all infrastructure entries including standard fields (even if empty). Returns complete infrastructure table for session bundling and status reports.

Takes no parameters.

get_all_intent_keywords_with_counts

Get All Intent Keywords With Counts

Get all unique intent keywords with usage counts for analytics

Takes no parameters.

get_all_modules

Get All Modules

Get all modules in the project. Returns list of all module records sorted by name.

Takes no parameters.

get_all_themes

Get All Themes

Get all project themes (high-level architectural areas). Use to orient on project structure before starting work.

Takes no parameters.

get_categories

Get Categories

Get all directive categories

Takes no parameters.

get_category_by_name

Get Category By Name

Get category by name (fairly frequent)

Parameterscategory_namerequired

get_claude_permissions

Get Claude Permissions

Returns the Claude Code allowlist (.claude/settings.local.json contents) that pre-approves every AIMFP MCP tool, so the user is not prompted once per tool on first use. Allowlist is derived live from the tool registry so it can never drift. Does NOT write any file — returns ready-to-write JSON + target path; the AI writes/merges it, keeping AIMFP's 'never write outside .aimfp-project/' guarantee intact. Call when the user asks to set up AIMFP permissions or skip approval prompts.

Parametersexisting_settings

get_completion_loop_target

Get Completion Loop Target

Get where to loop back after completing directive

Parametersfrom_directiverequired

get_completion_paths_by_status

Get Completion Paths By Status

Get completion paths filtered by status

Parametersstatusrequired

get_core_fields

Get Core Fields

Get field names and types for a specific table

Parameterstablerequired

get_core_schema

Get Core Schema

Get complete schema for core database (all tables and fields)

Takes no parameters.

get_core_tables

Get Core Tables

List all tables in core database

Takes no parameters.

get_current_branch

Get Current Branch

Get current Git branch name

Takes no parameters.

get_current_commit_hash

Get Current Commit Hash

Get current Git HEAD commit hash

Takes no parameters.

get_current_progress

Get Current Progress

Single entry point for scoped project status queries. Replaces 5-10 separate helper calls with one flexible query.

Parametersscopefiltersdetail_level

get_databases

Get Databases

Get list of all available databases with metadata

Takes no parameters.

get_directive_by_name

Get Directive By Name

Load a directive's workflow steps, preferences, and linked notes by name. ALWAYS call BEFORE executing any workflow — directives are the authoritative source, not memory.

Parametersproject_rootdirective_namerequired

get_directive_content

Get Directive Content

Read and return the full MD documentation file for a directive. Resolves the md_file_path from aimfp_core.db to an absolute path within the installed package, reads the file, and returns content + absolute path + token estimate.

Parametersdirective_namerequired

get_directive_execution_stats

Get Directive Execution Stats

Read execution statistics from directive_executions joined to directive names and statuses, for one user directive or all of them. Includes a derived error_rate per row. This is how the AI sees what the user's automation did while no session was open — executions, successes, errors, average and maximum duration, and the last recorded error. On a database at schema 1.3 or later, each row also carries skip_count, consecutive_skip_count, last_skip_time, last_skip_reason, condition_latched and last_condition_eval_time.

Parametersdirective_idproject_root

get_directive_flows

Get Directive Flows

General-purpose query for directive flows by category, type, or directive names. Complements the navigation helpers (get_flows_from_directive, get_flows_to_directive, get_wildcard_flows), which answer where a specific directive routes.

Parametersflow_typeto_directiveflow_categoryfrom_directive

get_directive_keywords

Get Directive Keywords

Get all intent keywords for a specific directive

Parametersdirective_idrequired

get_directives_by_category

Get Directives By Category

Get all directives in a category

Parameterscategory_namerequired

get_directives_by_type

Get Directives By Type

Get all directives filtered by type (orchestration vs reference)

Parameterstyperequiredinclude_md_content

get_directives_for_helper

Get Directives For Helper

Get all directives that use a helper (reciprocal lookup)

Parametershelper_namerequired

get_directives_with_intent_keywords

Get Directives With Intent Keywords

Search directives by intent keywords and return full directive objects

Parameterskeywordsrequiredmatch_modeinclude_keyword_matches

get_file_by_name

Get File By Name

Look up a tracked file by name — use BEFORE reading source files. Returns metadata, path, and ID for follow-up queries.

Parametersfile_namerequired

get_file_by_path

Get File By Path

Look up a tracked file by path — use BEFORE reading source files. Returns file metadata and ID for follow-up queries.

Parametersfile_pathrequired

get_file_ids_from_flows

Get File Ids From Flows

Get all file IDs associated with flows

Parametersflow_idsrequired

get_files_by_flow

Get Files By Flow

Get all files for a flow

Parametersflow_idrequired

get_files_by_flow_context

Get Files By Flow Context

Get all files for a flow with functions embedded in each file dict.

Parametersflow_idrequired

get_flow_by_name

Get Flow By Name

Get flow by name (fairly frequent)

Parametersflow_namerequired

get_flows_for_file

Get Flows For File

Get all flows for a file

Parametersfile_idrequired

get_flows_for_milestone

Get Flows For Milestone

Get the flows a milestone builds or changes (id, name, description). Use for task flow_ids and before starting milestone work.

Parametersmilestone_idrequired

get_flows_for_theme

Get Flows For Theme

Get all flows for a theme

Parameterstheme_idrequired

get_flows_from_directive

Get Flows From Directive

Get all flows originating from a directive (what comes next?). Returns raw flow data - AI evaluates conditions.

Parametersfrom_directiverequired

get_flows_to_directive

Get Flows To Directive

Get all directive flows leading to a directive (what leads here?). Useful for understanding directive prerequisites.

Parametersto_directiverequired

get_fp_directive_index

Get Fp Directive Index

Get lightweight FP directive index grouped by category (names only, not full definitions)

Takes no parameters.

get_from_core

Get From Core

Get records by ID(s), or all records if empty array

Parameterstablerequiredid_arrayrequired

get_from_core_where

Get From Core Where

Flexible filtering with structured JSON conditions

Parameterslimittablerequiredorderbyconditionsrequired

get_from_project

Get From Project

Get records by ID(s) - **EMPTY ARRAY NOT ALLOWED**

Parameterstablerequiredid_arrayrequired

get_from_project_where

Get From Project Where

Flexible filtering with structured JSON conditions

Parameterslimittablerequiredorderbyconditionsrequired

get_from_settings

Get From Settings

Get records by ID(s) - **EMPTY ARRAY NOT ALLOWED**

Parameterstablerequiredid_arrayrequired

get_from_settings_where

Get From Settings Where

Flexible filtering with structured JSON conditions

Parameterstablerequiredconditionsrequired

get_from_user_custom

Get From User Custom

Get records by ID(s) from user_directives.db - **EMPTY ARRAY NOT ALLOWED**

Parameterstablerequiredid_arrayrequired

get_from_user_custom_where

Get From User Custom Where

Flexible filtering with structured JSON conditions on user_directives.db tables

Parameterstablerequiredconditionsrequired

get_function_by_name

Get Function By Name

Look up a tracked function by name with file location — use BEFORE reading source files. Returns purpose, parameters, returns, and file path.

Parametersfile_idfile_pathdetails_onlyfunction_namerequiredinclude_details

get_functions_by_file

Get Functions By File

Get all tracked function signatures for a file — use BEFORE reading source code. Often provides everything needed without opening the file.

Parametersfile_idrequireddetails_onlyinclude_details

get_git_status

Get Git Status

Get comprehensive Git state snapshot (orchestrator)

Takes no parameters.

get_helper_by_name

Get Helper By Name

Get specific helper function details (high-frequency)

Parametershelper_namerequired

get_helpers_are_sub

Get Helpers Are Sub

Get all sub-helpers (is_sub_helper=true)

Takes no parameters.

get_helpers_are_tool

Get Helpers Are Tool

Get all MCP tools (is_tool=true)

Takes no parameters.

get_helpers_by_database

Get Helpers By Database

Get all helpers for a specific database

Parameterstarget_databaserequired

get_helpers_for_directive

Get Helpers For Directive

Get the list of MCP tools available for a directive workflow. Use to discover which tools to call when executing a directive's steps.

Parametersdirective_namerequiredinclude_helpers_data

get_hooks

Get Hooks

Get AIMFP's library surface for code running OUTSIDE AIMFP (src/aimfp/hooks/). Hooks are NOT MCP tools and you cannot call them — they are imported by code that is not AIMFP, such as a generated Use Case 2 automation runner firing from cron or systemd with no AI session open. Your relationship to a hook is that you WRITE CODE CALLING IT during user_directive_implement. Queries is_hook=1 affirmatively; it replaced get_helpers_not_tool_not_sub, which described hooks as the absence of two other flags and so returned an empty list silently for as long as nothing populated that gap.

Takes no parameters.

get_incomplete_completion_paths

Get Incomplete Completion Paths

Get all non-completed paths

Takes no parameters.

get_incomplete_items

Get Incomplete Items

Get incomplete items for any parent type

Parametersfor_idrequiredfor_tablerequired

get_incomplete_milestones

Get Incomplete Milestones

Get all non-completed milestones

Parametersdetail_levelinclude_task_counts

get_incomplete_sidequests

Get Incomplete Sidequests

Get all non-completed sidequests

Takes no parameters.

get_incomplete_subtasks

Get Incomplete Subtasks

Get all non-completed subtasks

Takes no parameters.

get_incomplete_subtasks_by_task

Get Incomplete Subtasks By Task

Get incomplete subtasks for specific task

Parameterstask_idrequired

get_incomplete_tasks

Get Incomplete Tasks

Get all unfinished tasks (pending, in_progress, blocked) as flat task rows. Does NOT include subtasks, sidequests or items: use get_open_work for the whole open tree (tasks with their open items and subtasks, plus sidequests) in one call.

Parametersdetail_level

get_incomplete_tasks_by_milestone

Get Incomplete Tasks By Milestone

Get open tasks for a milestone with related subtasks/sidequests

Parametersmilestone_idrequiredskip_pending

get_infrastructure_by_type

Get Infrastructure By Type

Get all infrastructure of specific type

Parameterstyperequired

get_interactions_by_file

Get Interactions By File

Get all interactions involving functions in a file or a set of files (file_ids), each with source and target function names and file paths — one call for a feature's whole dependency picture.

Parametersfile_idfile_ids

get_interactions_by_function

Get Interactions By Function

Get all interactions for a function (both as source and target) — trace dependency graphs

Parametersfile_pathfunction_idfunction_name

get_items_for_sidequest

Get Items For Sidequest

Get items for sidequest

Parametersstatussidequest_idrequired

get_items_for_subtask

Get Items For Subtask

Get items for subtask

Parametersstatussubtask_idrequired

get_items_for_task

Get Items For Task

Get items for task, optionally filtered by status

Parametersstatustask_idrequired

get_merge_history

Get Merge History

(For use with InterCommAIMFP) Read tool over the existing merge_history and work_branches tables: which branches were integrated, when, with how many conflicts, by whom. Lets the master answer 'has this branch already been applied?' (idempotency / resume after interruption) and gives a human an audit trail. Pure read; small surface over data merge_worker_branch records.

Parameterssincebranch

get_milestones_by_path

Get Milestones By Path

Get all milestones for a completion path

Parametersdetail_levelcompletion_path_idrequiredinclude_task_counts

get_milestones_by_status

Get Milestones By Status

Get milestones filtered by status

Parametersstatusrequireddetail_levelinclude_task_counts

get_module_by_name

Get Module By Name

Get module by name. Returns module record with path, purpose, and external_dependencies.

Parametersnamerequired

get_module_by_path

Get Module By Path

Get module by directory path.

Parameterspathrequired

get_module_dependencies

Get Module Dependencies

Get cross-module dependencies. Finds interactions where a function in this module calls a function in a different module via module_files junction. Returns aggregated counts per target module.

Parametersmodule_idrequired

get_module_files

Get Module Files

Get all files assigned to a module via module_files junction table.

Parametersmodule_idrequired

get_module_for_file

Get Module For File

Find which module a file belongs to. Reverse lookup via module_files junction table.

Parametersfile_idrequired

get_module_functions

Get Module Functions

Get all functions in module files. Joins through module_files junction to files to functions.

Parametersmodule_idrequired

get_module_types

Get Module Types

Get all types in module files. Joins through module_files junction to files to types.

Parametersmodule_idrequired

get_next_completion_path

Get Next Completion Path

Get lowest order_index with status != completed

Takes no parameters.

get_notes_comprehensive

Get Notes Comprehensive

Query notes with structured filters (id, type, reference, source, severity, directive). Use note_id to read one note in full, e.g. after search_notes returned a preview.

Parameterslimitsourcenote_idseveritynote_typereference_idpreview_charsdirective_namereference_tableexclude_note_types

get_open_work

Get Open Work

Every open task (pending, in_progress, blocked) with its open items and open subtasks (each with open items), plus open sidequests with their open items, in one read-only call. Ordered in_progress first, then by priority. Replaces get_incomplete_tasks followed by one get_items_for_task per task.

Parametersmilestone_idinclude_descriptions

get_pending_notices

Get Pending Notices

Get one-time release notices this project has not yet been shown. Returns ONLY unacknowledged notices, already filtered for applicability — a notice pinned to a schema version stays hidden until that database has actually reached it. An empty result is the normal steady state. Called automatically by aimfp_run(is_new_session=true), which puts the result in data.notices and omits the key entirely when nothing is pending, so you never need to call this yourself in a normal session.

Takes no parameters.

get_project

Get Project

Get project metadata (single entry)

Takes no parameters.

get_project_fields

Get Project Fields

Get field names and types for a specific table

Parameterstablerequired

get_project_json_parameters

Get Project Json Parameters

Get available fields for table to use with generic add/update operations

Parameterstablerequired

get_project_root

Get Project Root

Get project root directory from infrastructure table

Takes no parameters.

get_project_schema

Get Project Schema

Get complete schema for project database

Takes no parameters.

get_project_tables

Get Project Tables

List all tables in project database

Takes no parameters.

get_recent_directive_errors

Get Recent Directive Errors

Tail the JSON-lines directive error log, newest first, optionally filtered to one directive. Each record carries directive_id, error_type, message, timestamp, and a full traceback when the failure came from a handler exception. The database keeps only the last error per directive (store_last_error_only defaults to 1), so this file is the only place error history survives.

Parameterslimitdirective_idproject_root

get_settings_fields

Get Settings Fields

Get field names and types for a specific table

Parameterstablerequired

get_settings_json_parameters

Get Settings Json Parameters

Get available fields for table to use with generic add/update operations

Parameterstablerequired

get_settings_schema

Get Settings Schema

Get complete schema for user settings database

Takes no parameters.

get_settings_tables

Get Settings Tables

List all tables in user settings database

Takes no parameters.

get_sidequest_files

Get Sidequest Files

Get the files worked on for a sidequest (task_files junction). Files are linked automatically when reserved, finalized, cataloged, or updated (and when their functions/types are finalized, cataloged, or updated) while a work item is in_progress — the most recent in_progress sidequest, else subtask, else task.

Parameterssidequest_idrequired

get_sidequest_flows

Get Sidequest Flows

Get flow IDs for a sidequest

Parameterssidequest_idrequired

get_sidequests_comprehensive

Get Sidequests Comprehensive

Advanced sidequest search

Parameterslimitstatustask_idprioritysubtask_iddate_range_createddate_range_updated

get_source_directory

Get Source Directory

Get project source directory from infrastructure table

Takes no parameters.

get_state_operations_template

Get State Operations Template

Return the Python state_operations.py template content for AI to adapt to the project's language. Use this to retrieve the CRUD helper template for .state/runtime.db.

Takes no parameters.

get_structure_health

Get Structure Health

Report the project's modularity layer and every gap in it: themes -> flows -> files, open paths -> themes, open milestones -> flows, module membership. Gaps: flows without theme, themes without flows, files without flow (and no no_flow_reason), files under a module path but in no module, open paths without themes, open milestones without flows, oversized flow descriptions (split candidates). The same report appears in aimfp_status, aimfp_end and watchdog reminders.

Parametersinclude_summary

get_subtasks_by_task

Get Subtasks By Task

Get subtasks for task, optionally filtered by status

Parametersstatustask_idrequired

get_subtasks_comprehensive

Get Subtasks Comprehensive

Advanced subtask search

Parameterslimitstatustask_idprioritydate_range_createddate_range_updated

get_supportive_context

Get Supportive Context

Returns supportive context reference documents by variant. All variants auto-provided: core + coding by aimfp_run(is_new_session=true) for initialized projects, case2 by aimfp_run when Case 2 active, init by aimfp_init(). Also callable on demand to reload stale context.

Parametersvariant

get_system_prompt

Get System Prompt

Returns the AIMFP system prompt (AIMFP's record-keeping backbone) plus where and how to place it. The user's FIRST move — especially for plugin installs where nothing was downloaded — is to ask the AI to add the AIMFP system prompt; the AI calls this and writes the file. Does NOT write anything: returns the prompt text + target path + placement policy; the AI does the write, keeping AIMFP's 'never write outside .aimfp-project/' guarantee. AIMFP content is always placed FIRST; if the existing instructions file is extensive the AI must review/consolidate with the user instead of blindly prepending.

Parametersexisting_content

get_task_context

Get Task Context

Get complete context for resuming work on a specific task/subtask/sidequest. Single call retrieves item + associated items + linked files + their functions and modules + flows + optionally interactions and notes. Files are linked automatically when reserved, finalized, cataloged, or updated (and when their functions/types are finalized, cataloged, or updated) while a work item is in_progress — the most recent in_progress sidequest, else subtask, else task. A task's context includes its subtasks' files. Uses cached project root internally.

Parameterstask_idrequiredtask_typedetail_levelinclude_historyinclude_interactions

get_task_files

Get Task Files

Get the files worked on for a task, including files linked to its subtasks (task_files junction). Files are linked automatically when reserved, finalized, cataloged, or updated (and when their functions/types are finalized, cataloged, or updated) while a work item is in_progress — the most recent in_progress sidequest, else subtask, else task.

Parameterstask_idrequired

Version history

1
  1. v1.70.0LatestNov 1, 2026

Score

80% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts
  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

    Declare a license in the repository or the registry entry.