AIMFP
v1.71.0Database-driven directives and project tracking for modular functional-procedural AI coding
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
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.
| Parameter | Type | Description |
|---|---|---|
notice_key * | string | Notice identifier from get_pending_notices (e.g. 'backup_interval_intro') |
outcome | string | Short record of what the user decided (e.g. 'set backup_interval_days=14'). Kept for audit and worth filling in. |
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.
| Parameter | Type | Description |
|---|---|---|
directive_id * | integer | ID of the directive to activate |
add_completion_path
Add completion path stage
| Parameter | Type | Description |
|---|---|---|
name * | string | Completion path name (e.g., 'setup', 'core dev', 'finish') |
description | string | Description |
order_index | integer | Order position (1, 2, 3...) |
status | string | 'pending', 'in_progress', 'completed' |
theme_ids | array | Themes (stable project areas) this path advances. Optional here; link later with add_path_themes. |
add_directive_preference
Add/update user preference for directive
| Parameter | Type | Description |
|---|---|---|
directive_name * | string | Directive name |
preference_key * | string | Preference key |
preference_value * | string | Preference value |
active | boolean | Whether preference is active |
description | string | Optional note on what this preference does, stored with it in directive_preferences |
add_file_flows
Batch-assign multiple files to flows. Skips existing links silently. More efficient than multiple add_file_to_flow calls.
| Parameter | Type | Description |
|---|---|---|
links * | array | Array of [file_id, flow_id] tuples to create |
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.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID (from reserve_file/finalize_file) |
flow_id * | integer | Flow ID (from add_flow or get_all_flows) |
add_file_to_module
Assign a file to a module. Creates module_files junction entry. Same pattern as add_file_to_flow.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to assign |
module_id * | integer | Module ID to assign to |
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.
| Parameter | Type | Description |
|---|---|---|
links * | array | List of [file_id, module_id] tuples to assign |
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.
| Parameter | Type | Description |
|---|---|---|
name * | string | Flow name |
theme_ids * | array | IDs of the theme(s) this flow belongs to — at least one. Every flow belongs to a theme; pick from get_all_themes() or add_theme() first. |
ai_generated | boolean | True if AI-generated |
confidence_score | number | Confidence score 0-1 |
description | string | Flow description |
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.
| Parameter | Type | Description |
|---|---|---|
links * | array | Array of [flow_id, theme_id] pairs. One pair links one; many pairs (any mix of flow_ids) apply atomically. |
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).
| Parameter | Type | Description |
|---|---|---|
interaction_type * | string | Interaction type ('call', 'chain', 'borrow', 'compose', 'pipe') |
source * | string | Source function name |
target * | string | Target function name |
description | string | What the dependency is (optional) |
is_indirect | boolean | True for a deliberate edge the code makes indirectly (dispatch through a tuple/table of functions, a chain data-flow link): audit_interactions never reports it as stale. |
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.
| Parameter | Type | Description |
|---|---|---|
interactions * | array | Array of tuples [(source_function_id, target_function_id, interaction_type, description[, is_indirect]), ...] - type: 'call', 'chain', 'borrow', 'compose', 'pipe'. Optional 5th element is_indirect (bo… |
add_item
Create a single work item under a task, subtask, or sidequest. Items are the smallest trackable units of work.
| Parameter | Type | Description |
|---|---|---|
name * | string | Item name |
reference_id * | integer | ID of the parent task, subtask, or sidequest |
reference_table * | string | 'tasks', 'subtasks', or 'sidequests' |
description | string | Item description |
status | string | 'pending', 'in_progress', 'completed' (default: pending) |
add_items
Batch-create multiple work items under a single parent in one call. All items created with status 'pending'.
| Parameter | Type | Description |
|---|---|---|
items * | array | Array of {name: string, description?: string} objects |
reference_id * | integer | ID of the parent task, subtask, or sidequest |
reference_table * | string | 'tasks', 'subtasks', or 'sidequests' |
add_milestone
Add milestone to completion path
| Parameter | Type | Description |
|---|---|---|
completion_path_id * | integer | Completion path ID this milestone belongs to |
name * | string | Milestone name |
description | string | Milestone description |
flow_ids | array | Flows this milestone builds or changes. Optional here; link later with add_milestone_flows. |
status | string | 'pending', 'in_progress', 'completed', 'blocked' |
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.
| Parameter | Type | Description |
|---|---|---|
links * | array | Array of [milestone_id, flow_id] pairs. One pair links one; many pairs (any mix of milestone_ids) apply atomically. |
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.
| Parameter | Type | Description |
|---|---|---|
name * | string | Module name (e.g., 'wallet_connection', 'validation') |
path * | string | Directory path relative to source root (e.g., 'src/wallet_connection/') |
description | string | What this module does |
external_dependencies | array | Libraries/services this module wraps (e.g., ['walletconnect', 'stripe']) |
purpose | string | Domain concern this module owns (one sentence) |
add_note
Record a decision, architecture change, or context event in the project's audit trail. Supports typed notes with optional directive linking.
| Parameter | Type | Description |
|---|---|---|
content * | string | Note content/message |
note_type * | string | 'clarification', 'pivot', 'research', 'entry_deletion', 'warning', 'error', 'info', 'auto_summary', 'decision', 'evolution', 'analysis', 'task_context', 'external', 'summary' |
directive_name | string | Optional directive context for note |
reference_id | integer | ID of the referenced table entry |
reference_table | string | project.db table this note is attached to (e.g. 'files', 'tasks', 'flows', 'completion_path'). Must be an existing project.db table name, exactly: unknown names are refused, because the getters that s… |
send_with_directive | boolean | If true and directive_name set, note is included when that directive is retrieved. Turns notes into contextual reminders that travel with their directive. |
severity | string | 'info', 'warning', 'error' (default 'info') |
source | string | 'ai', 'user', or 'directive' (default 'ai') |
add_path_themes
Batch-link completion paths to the themes (stable project areas) they advance (completion_path_themes). Themes change rarely, like paths.
| Parameter | Type | Description |
|---|---|---|
links * | array | Array of [completion_path_id, theme_id] pairs. One pair links one; many pairs (any mix of completion_path_ids) apply atomically. |
add_project_entry
Add new entry to project database
| Parameter | Type | Description |
|---|---|---|
data * | object | Field-value pairs |
table * | string | Table name |
add_settings_entry
Add entry to user settings database
| Parameter | Type | Description |
|---|---|---|
data * | object | Field-value pairs |
table * | string | Table name |
add_sidequest
Create an urgent interruption that pauses the current task. Use for bug fixes, blockers, or unexpected work discovered mid-task.
| Parameter | Type | Description |
|---|---|---|
name * | string | Sidequest name |
paused_task_id * | integer | ID of the task being paused for this sidequest |
description | string | Sidequest description |
flow_ids | array | JSON array of flow IDs |
paused_subtask_id | integer | If sidequest during subtask |
priority | string | Sidequest priority (default: critical) |
status | string | Sidequest status (default: pending) |
add_subtask
Create a focused sub-unit of work under a parent task. The parent is paused until all subtasks complete.
| Parameter | Type | Description |
|---|---|---|
name * | string | Subtask name |
parent_task_id * | integer | Parent task ID |
description | string | Subtask description |
priority | string | 'low', 'medium', 'high', 'critical' |
status | string | 'pending', 'in_progress', 'completed', 'blocked' |
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.
| Parameter | Type | Description |
|---|---|---|
milestone_id * | integer | ID of the milestone this task belongs to |
name * | string | Task name |
description | string | Task description |
flow_ids | array | JSON array of flow IDs |
priority | string | Task priority (default: medium) |
status | string | Task status (default: pending) |
add_theme
Add project theme
| Parameter | Type | Description |
|---|---|---|
name * | string | Theme name |
ai_generated | boolean | True if AI-generated, False if user-created |
confidence_score | number | Confidence score 0-1 |
description | string | Theme description |
add_tracking_note
Add tracking note to user_preferences.db (only when tracking enabled)
| Parameter | Type | Description |
|---|---|---|
content * | string | Note content/message |
note_type * | string | 'fp_analysis', 'user_interaction', 'validation', 'performance', 'debug' |
directive_name | string | Directive that created this note |
metadata_json | string | Additional context as JSON string |
reference_id | integer | Optional ID if referencing project.db entity |
reference_name | string | Name of referenced entity (e.g., function name, file path) |
reference_type | string | Type of reference (e.g., 'function', 'file', 'directive') |
severity | string | 'info', 'warning', 'error' (default 'info') |
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.
| Parameter | Type | Description |
|---|---|---|
relationships * | array | Array of tuples [(type_id, function_id, role), ...] - role: 'factory', 'transformer', 'operator', 'pattern_matcher', 'accessor', 'validator', 'combinator' |
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.
| Parameter | Type | Description |
|---|---|---|
data * | object | Field-value pairs to insert |
table * | string | Table name in user_directives.db |
add_user_directive_note
Add note to user_directives.db notes table for AI record-keeping
| Parameter | Type | Description |
|---|---|---|
content * | string | Note content/message |
note_type * | string | 'implementation', 'validation', 'execution', 'dependency', 'error', 'optimization', 'user_feedback', 'lifecycle', 'testing', 'general', 'deferred', 'completed', 'obsolete', 'entry_deletion' |
metadata_json | string | Additional context as JSON string |
reference_id | integer | Optional ID linking to user_directives, helper_functions, etc. |
reference_name | string | Name of referenced entity (e.g., directive name, helper name, file path) |
reference_type | string | Type of reference: 'directive', 'helper', 'dependency', 'file' |
severity | string | 'info', 'warning', 'error' (default 'info') |
add_user_setting
Add new project-wide user setting to user_settings table
| Parameter | Type | Description |
|---|---|---|
setting_key * | string | Setting key (must be unique) |
setting_value * | string | Setting value |
description | string | Description of the setting |
scope | string | Setting scope (default 'project') |
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.
aimfp_init
Phase 1 mechanical setup orchestrator for project initialization. Atomically creates directories, databases with schemas, and templates. No deep logic - pure mechanical operations.
| Parameter | Type | Description |
|---|---|---|
project_root * | string | Path to project root directory |
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.
| Parameter | Type | Description |
|---|---|---|
is_new_session | boolean | Whether this is a new session start. Use true for first interaction, new session, or after long breaks. Use false (default) for continuation work. |
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.
| Parameter | Type | Description |
|---|---|---|
type | string | Tier: 'quick' (default) = position only (path, milestone, focused work with item names, their flows/themes, other open work, structure gap count), for completion loops and 'where am I' checks. 'summar… |
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 i…
| Parameter | Type | Description |
|---|---|---|
reason * | string | Why these changes are made; recorded in the restore-manifest note. |
add_interactions | array | Edges to add (interaction_type defaults to 'call'). |
add_type_links | array | types_functions links to add. |
apply | array | Finding categories of the report to apply. missing_interactions=add, stale_interactions=delete (indirect edges kept), repoint_interactions=move source/target, stale_functions/stale_types=delete (casca… |
baseline_hash_function_ids | array | Functions whose current code hash is recorded as matching their description. Only after reviewing purpose/parameters/returns. |
cleanup | boolean | Delete the report file after a successful real run. |
delete_function_ids | array | Functions to delete; their interactions and type links cascade and are recorded in the manifest. |
delete_interaction_ids | array | Interactions to delete. |
delete_type_ids | array | Types to delete; their type links cascade and are recorded in the manifest. |
dry_run | boolean | Do everything, then roll back: the result is exactly what a real run does. |
exclude | object | Findings of applied categories to hold back (reviewed false positives), as {category: [ids]}: interaction_id for stale/repoint_interactions, function_id for stale_functions/param_mismatch/unbaselined_… |
exempt | array | Reviewed findings that are NOT drift (schema 1.16): [{category, function_id | type_id, reason?}], reason defaulting to the call's. Audits list them under 'exempted' (info) instead of the category, so… |
mark_indirect_ids | array | Interactions to mark is_indirect: deliberate edges the code makes indirectly. Audits never flag them; report deletes skip them. |
refresh_signature_function_ids | array | Functions whose parameters are re-read from the source (names, order, types, required/default), keeping each surviving parameter's description. |
repoint_interactions | array | Edges to move to a new source and/or target. |
report | string | report_path returned by an audit tool (project-relative path, absolute path, or bare file name in the audit folder). |
unexempt_ids | array | audit_exemptions ids (exemption_id in an audit's 'exempted' list) to remove; the finding is reported again. Removed rows go into the manifest. |
unmark_indirect_ids | array | Interactions to clear is_indirect on. |
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. Refuses to run on a main DB that fails an integrity/core-table check. Mutates the working .aimfp-project/pr…
| Parameter | Type | Description |
|---|---|---|
changeset | object | The changeset object produced by export_state_changeset (provenance, entities[], references[]). Optional when changeset_id is given. |
changeset_id | string | Handle returned by export_state_changeset; loads the persisted changeset from .aimfp-project/changesets/ so you never re-transcribe the full object. Used only when changeset is omitted. |
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…
| Parameter | Type | Description |
|---|---|---|
file_ids | array | Tracked file IDs to audit. |
module_path | string | Audit every file under this project-relative directory. |
paths | array | Project-relative file paths to audit (tracked or not). |
since_commit | string | Audit files changed since this git ref ('HEAD' = uncommitted work, or a branch/commit): committed, staged, unstaged and new untracked files. |
task_id | integer | Audit the files linked to this task (a task includes its subtasks' files). |
task_type | string | 'task' (default), 'subtask' or 'sidequest' — the kind of work item task_id names. |
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…
| Parameter | Type | Description |
|---|---|---|
file_ids | array | Tracked file IDs to audit. |
module_path | string | Audit every file under this project-relative directory. |
paths | array | Project-relative file paths to audit (tracked or not). |
since_commit | string | Audit files changed since this git ref ('HEAD' = uncommitted work, or a branch/commit): committed, staged, unstaged and new untracked files. |
task_id | integer | Audit the files linked to this task (a task includes its subtasks' files). |
task_type | string | 'task' (default), 'subtask' or 'sidequest' — the kind of work item task_id names. |
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 e…
| Parameter | Type | Description |
|---|---|---|
file_ids | array | Tracked file IDs to audit. |
module_path | string | Audit every file under this project-relative directory. |
paths | array | Project-relative file paths to audit (tracked or not). |
since_commit | string | Audit files changed since this git ref ('HEAD' = uncommitted work, or a branch/commit): committed, staged, unstaged and new untracked files. |
task_id | integer | Audit the files linked to this task (a task includes its subtasks' files). |
task_type | string | 'task' (default), 'subtask' or 'sidequest' — the kind of work item task_id names. |
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 un…
| Parameter | Type | Description |
|---|---|---|
file_ids | array | Tracked file IDs to audit. |
full | array | Finding categories to return inline in full, whatever sample_limit says (e.g. ['stale_descriptions']). Unknown category names are an error. |
include | array | Audits to run (default all): functions (files, functions, types, parameters, JSON, type links), interactions (missing/stale/repoint edges), descriptions (stale prose, dangling mentions), structure (mo… |
module_path | string | Audit every file under this project-relative directory. |
paths | array | Project-relative file paths to audit (tracked or not). |
sample_limit | integer | Findings shown inline per category (default 5; 0 = counts only). The report file always has every finding. |
since_commit | string | Audit files changed since this git ref ('HEAD' = uncommitted work, or a branch/commit): committed, staged, unstaged and new untracked files. |
task_id | integer | Audit the files linked to this task (a task includes its subtasks' files). |
task_type | string | 'task' (default), 'subtask' or 'sidequest' — the kind of work item task_id names. |
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.
batch_update_progress
Update multiple project items atomically. Used after code generation or bulk operations to ensure consistency.
| Parameter | Type | Description |
|---|---|---|
updates * | array | List of update objects: [{target_type, target_id, action, data}, ...] data.audit_override_reason completes a task/subtask/sidequest despite blocking tracking-audit findings (recorded as a warning note… |
continue_on_error | boolean | Stop on first error or continue processing remaining updates |
transaction | boolean | All-or-nothing commit vs independent updates |
blueprint_has_changed
Check if ProjectBlueprint.md has changed using Git or filesystem timestamp
| Parameter | Type | Description |
|---|---|---|
blueprint_path * | string | Absolute path to ProjectBlueprint.md file |
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.
| Parameter | Type | Description |
|---|---|---|
files * | array | Array of {name, path, language} objects. 'path' is project-relative and is the identity key. |
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.
| Parameter | Type | Description |
|---|---|---|
functions * | array | Array of {name, file_id, purpose, parameters, returns} objects. 'parameters' is a list of param dicts and 'returns' a dict; both are JSON-encoded on write. |
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.
| Parameter | Type | Description |
|---|---|---|
types * | array | Array of {name, file_id, definition, description} objects. 'definition' is a dict describing the type shape and is JSON-encoded on write. |
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_…
| Parameter | Type | Description |
|---|---|---|
error_rate_threshold | number | Error rate at or above which a directive is reported degraded |
project_root | string | Project root; defaults to the session root |
skip_threshold | integer | Consecutive skipped occurrences at or above which a directive is reported skipping |
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.
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.).
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.
| Parameter | Type | Description |
|---|---|---|
field * | string | Field name to get allowed values for |
table * | string | Table name to check for CHECK constraints |
create_project
Initialize project entry (one per database)
| Parameter | Type | Description |
|---|---|---|
goals * | array | Array of goal strings (e.g., ['Fast computation', 'No OOP']) |
name * | string | Project name (e.g., 'MatrixCalculator') |
purpose * | string | Project purpose (e.g., 'Build a pure functional matrix math library') |
status | string | 'active', 'paused', 'completed', 'abandoned' |
user_directives_status | string | NULL (Case 1), 'pending_discovery', 'pending_parse', 'in_progress', 'active', 'disabled' |
version | integer | Tracks idea evolution (starts at 1) |
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.
create_state_database
Create per-project state database (.state/runtime.db) from SQL schema. FP-compliant replacement for mutable global variables.
| Parameter | Type | Description |
|---|---|---|
source_directory * | string | Absolute path to project source directory (from infrastructure.source_directory) |
create_user_branch
Create work branch following aimfp-{user}-{number} convention
| Parameter | Type | Description |
|---|---|---|
purpose * | string | Branch purpose description |
user * | string | Username |
deactivate_user_directive
Set directive status to 'paused'. Does NOT stop services - AI handles service shutdown via directive workflow.
| Parameter | Type | Description |
|---|---|---|
directive_id * | integer | ID of the directive to deactivate |
delete_completion_path
Delete completion path with milestone validation
| Parameter | Type | Description |
|---|---|---|
id * | integer | Completion path ID |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_custom_return_statement
Delete custom return statement(s) for a helper function. By ID, by text, or all for a helper.
| Parameter | Type | Description |
|---|---|---|
helper_name * | string | Helper function name |
statement | string | Specific statement text to delete (optional) |
statement_id | integer | Specific row ID to delete (optional) |
delete_file
Delete file with comprehensive cross-reference validation
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to delete |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_flow
Delete flow with file validation
| Parameter | Type | Description |
|---|---|---|
flow_id * | integer | Flow ID to delete |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
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.
| Parameter | Type | Description |
|---|---|---|
function_id * | integer | Function ID to delete |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
confirm_cascade | boolean | Delete the function's interactions with it. Without repoint_to or confirm_cascade, a function with interactions is refused and the edges are listed. |
note_type | string | 'entry_deletion' |
repoint_to | integer | Function ID that takes over this function's interactions (the split/move case). Edges that would become self-edges or duplicates are dropped. Every moved or dropped edge is written into the deletion n… |
delete_interaction
Delete interaction
| Parameter | Type | Description |
|---|---|---|
interaction_id * | integer | Interaction ID to delete |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_item
Delete item with status validation
| Parameter | Type | Description |
|---|---|---|
id * | integer | Item ID |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_milestone
Delete milestone with task validation
| Parameter | Type | Description |
|---|---|---|
id * | integer | Milestone ID |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_module
Delete a module. CASCADE removes module_files junction entries. Files themselves are NOT deleted.
| Parameter | Type | Description |
|---|---|---|
module_id * | integer | Module ID to delete |
delete_note
Delete note (discouraged)
| Parameter | Type | Description |
|---|---|---|
id * | integer | Note ID to delete |
delete_project_entry
Smart delete with automatic routing to specialized functions when needed
| Parameter | Type | Description |
|---|---|---|
id * | integer | Record ID |
note_reason * | string | Deletion reason |
note_severity * | string | "info", "warning", "error" |
note_source * | string | "ai" or "user" |
note_type * | string | "entry_deletion" |
table * | string | Table name |
delete_reserved
Delete abandoned reserved entries (escape hatch for cancelled reserve operations)
| Parameter | Type | Description |
|---|---|---|
id * | integer | Reserved record ID to delete |
note_reason * | string | Deletion reason (e.g., 'User cancelled operation', 'Correcting reservation error') |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
table * | string | Table name (must be 'files', 'functions', or 'types') |
note_type | string | 'entry_deletion' |
delete_settings_entry
Delete entry from user_preferences.db table
| Parameter | Type | Description |
|---|---|---|
record_id * | integer | Record ID to delete |
table * | string | Table name in user_preferences.db |
delete_sidequest
Delete sidequest with item validation (same logic as delete_task)
| Parameter | Type | Description |
|---|---|---|
id * | integer | Sidequest ID |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_subtask
Delete subtask with item validation (same logic as delete_task)
| Parameter | Type | Description |
|---|---|---|
id * | integer | Subtask ID |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_task
Delete task with item validation
| Parameter | Type | Description |
|---|---|---|
id * | integer | Task ID |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_theme
Delete theme with flow validation
| Parameter | Type | Description |
|---|---|---|
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
theme_id * | integer | Theme ID to delete |
note_type | string | 'entry_deletion' |
delete_type
Delete type with relationship validation
| Parameter | Type | Description |
|---|---|---|
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
type_id * | integer | Type ID to delete |
note_type | string | 'entry_deletion' |
delete_type_function
Remove type-function relationship
| Parameter | Type | Description |
|---|---|---|
id * | integer | types_functions junction table ID |
note_reason * | string | Deletion reason |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai' or 'user' |
note_type | string | 'entry_deletion' |
delete_user_custom_entry
Delete entry from user_directives.db table, writing an entry_deletion note in the same transaction
| Parameter | Type | Description |
|---|---|---|
record_id * | integer | Record ID to delete |
table * | string | Table name in user_directives.db |
note_reason | string | Why the row was deleted; recorded in the entry_deletion note ('no reason given' when omitted) |
note_source | string | Who deleted it: 'ai', 'user', or 'directive' (default 'ai'); stored in the note's metadata_json |
detect_conflicts_before_merge
Dry-run merge analysis - retrieves potential conflict data for AI to evaluate
| Parameter | Type | Description |
|---|---|---|
source_branch * | string | Branch to merge from |
detect_external_changes
Compare current Git HEAD with project.last_known_git_hash
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.
| Parameter | Type | Description |
|---|---|---|
branches * | array | List of {branch, base_commit, worker_id?} objects to cross-reference for semantic-key overlap |
execute_merge
Execute git merge and return result. Updates work_branches table on success.
| Parameter | Type | Description |
|---|---|---|
source_branch * | string | Branch to merge from |
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…
| Parameter | Type | Description |
|---|---|---|
base_commit * | string | Git commit the branch was based on (the 3-way base / branch point) |
branch * | string | Git ref (branch name or commit) whose committed project.db is the branch intent |
worker_id | string | Optional InterCommAIMFP worker identity; the master supplies it |
file_has_changed
Check if file changed using Git (if available) or filesystem timestamp
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to check |
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.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | Reserved ID |
language * | string | Language |
name * | string | Final name with _id_xx suffix |
path * | string | File path |
skip_id_naming | boolean | If true, skip _id_XX pattern validation (for files where ID naming was skipped during reservation) |
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).
| Parameter | Type | Description |
|---|---|---|
files * | array | Array of file objects [{file_id, name, path, language, skip_id_naming?}, ...] |
finalize_function
Mark a reserved function as tracked after writing it. Triggers interaction and type-function relationship checks.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID |
function_id * | integer | Reserved function ID |
name * | string | Final name with _idxx suffix |
parameters | array | Function parameters |
purpose | string | Function purpose |
returns | object | Return value specification |
skip_id_naming | boolean | If true, skip _id_XX pattern validation (for functions where ID naming was skipped during reservation) |
finalize_functions
Batch-finalize multiple reserved functions after writing them. Triggers interaction and type-function checks for all.
| Parameter | Type | Description |
|---|---|---|
functions * | array | Array of function objects [{function_id, name, file_id, purpose, parameters, returns, skip_id_naming?}, ...] |
finalize_type
Finalize reserved type after creation
| Parameter | Type | Description |
|---|---|---|
definition_json * | object | ADT definition |
name * | string | Final name with _idxx suffix |
type_id * | integer | Reserved type ID |
description | string | Type description |
file_id | integer | File ID where type is defined |
links | object | Links to related functions |
skip_id_naming | boolean | If true, skip _id_XX pattern validation (for types where ID naming was skipped during reservation) |
finalize_types
Finalize multiple reserved types
| Parameter | Type | Description |
|---|---|---|
types * | array | Array of type objects [{type_id, name, definition_json, description, links, file_id, skip_id_naming?}, ...] |
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.
| Parameter | Type | Description |
|---|---|---|
user_request * | string | User's natural language request describing behavior to change |
threshold | number | Confidence threshold |
find_directives_by_intent_keyword
Find directive IDs matching one or more intent keywords (direct keyword lookup)
| Parameter | Type | Description |
|---|---|---|
keywords * | Single keyword string or array of keywords | |
match_mode | string | "any" for OR logic, "all" for AND logic |
get_active_user_directives
Get all user directives with status='active'. Convenience query for checking active directive count.
get_all_completion_paths
Get the project's ordered completion roadmap (stages from setup through completion). Each path contains milestones which contain tasks.
get_all_directive_keywords
Get list of all unique intent keywords available for searching (simple list)
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.
| Parameter | Type | Description |
|---|---|---|
types | array | Optional array of directive types to filter: ['fp', 'project', 'git', 'user_preferences', 'user_system']. If not provided, returns ALL directive names. |
get_all_directives
Load all directives for caching (special orchestrator)
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.
| Parameter | Type | Description |
|---|---|---|
detail_level | string | 'lean' (default): descriptions are null. 'full': descriptions included. |
flow_ids | array | Only these flows, ordered by ID. IDs with no flow are named in return_statements. Omit for every flow. |
get_all_infrastructure
Get all infrastructure entries including standard fields (even if empty). Returns complete infrastructure table for session bundling and status reports.
get_all_intent_keywords_with_counts
Get all unique intent keywords with usage counts for analytics
get_all_modules
Get all modules in the project. Returns list of all module records sorted by name.
get_all_themes
Get all project themes (high-level architectural areas). Use to orient on project structure before starting work.
get_categories
Get all directive categories
get_category_by_name
Get category by name (fairly frequent)
| Parameter | Type | Description |
|---|---|---|
category_name * | string | Category name |
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.
| Parameter | Type | Description |
|---|---|---|
existing_settings | string | Current text of the project's .claude/settings.local.json if it already exists (read it and pass it in). When given, the result is a merge that preserves all non-AIMFP permissions and other top-level… |
get_completion_loop_target
Get where to loop back after completing directive
| Parameter | Type | Description |
|---|---|---|
from_directive * | string | Directive name |
get_completion_paths_by_status
Get completion paths filtered by status
| Parameter | Type | Description |
|---|---|---|
status * | string | 'pending', 'in_progress', 'completed' |
get_core_fields
Get field names and types for a specific table
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name |
get_core_schema
Get complete schema for core database (all tables and fields)
get_core_tables
List all tables in core database
get_current_branch
Get current Git branch name
get_current_commit_hash
Get current Git HEAD commit hash
get_current_progress
Single entry point for scoped project status queries. Replaces 5-10 separate helper calls with one flexible query.
| Parameter | Type | Description |
|---|---|---|
detail_level | string | 'minimal' (counts), 'lean' (default: key columns, open work first, 50 rows), 'full' (every column, every row). 'standard' is accepted as 'lean'. |
filters | object | WHERE-like conditions: {field: value} or {field: {operator: value}} |
scope | string | What to retrieve: 'tasks', 'milestones', 'completion_paths', 'files', 'functions', 'flows', 'themes', 'infrastructure', 'all' |
get_databases
Get list of all available databases with metadata
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.
| Parameter | Type | Description |
|---|---|---|
directive_name * | string | Directive name to look up |
project_root | string | Project root directory. When provided, also retrieves directive preferences from user_preferences.db and linked notes (send_with_directive=1) from project.db. |
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.
| Parameter | Type | Description |
|---|---|---|
directive_name * | string | Directive name (e.g., 'fp_purity', 'aimfp_init', 'project_file_write') |
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.
| Parameter | Type | Description |
|---|---|---|
directive_id | integer | One directive, or omit for all |
project_root | string | Project root; defaults to the session root |
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.
| Parameter | Type | Description |
|---|---|---|
flow_category | string | Filter by category: 'project', 'fp', 'user_preferences', 'git' |
flow_type | string | Filter by type: 'status_branch', 'completion_loop', 'conditional', 'error' |
from_directive | string | Filter by source directive name |
to_directive | string | Filter by target directive name |
get_directive_keywords
Get all intent keywords for a specific directive
| Parameter | Type | Description |
|---|---|---|
directive_id * | integer | Directive ID |
get_directives_by_category
Get all directives in a category
| Parameter | Type | Description |
|---|---|---|
category_name * | string | Category name |
get_directives_by_type
Get all directives filtered by type (orchestration vs reference)
| Parameter | Type | Description |
|---|---|---|
type * | string | One of: 'fp', 'project', 'git', 'user_system', 'user_preference' |
include_md_content | boolean | Include full MD file content |
get_directives_for_helper
Get all directives that use a helper (reciprocal lookup)
| Parameter | Type | Description |
|---|---|---|
helper_name * | string | Helper name |
get_directives_with_intent_keywords
Search directives by intent keywords and return full directive objects
| Parameter | Type | Description |
|---|---|---|
keywords * | Single keyword or array of keywords | |
include_keyword_matches | boolean | Include which keywords matched |
match_mode | string | "any" for OR logic, "all" for AND logic |
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.
| Parameter | Type | Description |
|---|---|---|
file_name * | string | File name to look up (e.g., 'calculator_id_42.py') |
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.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | File path to look up (e.g., 'src/calculator.py') |
get_file_ids_from_flows
Get all file IDs associated with flows
| Parameter | Type | Description |
|---|---|---|
flow_ids * | array | Array of flow IDs [1, 3, 5] |
get_files_by_flow
Get all files for a flow
| Parameter | Type | Description |
|---|---|---|
flow_id * | integer | Flow ID |
get_files_by_flow_context
Get all files for a flow with functions embedded in each file dict.
| Parameter | Type | Description |
|---|---|---|
flow_id * | integer | Flow ID to get files for |
get_flow_by_name
Get flow by name (fairly frequent)
| Parameter | Type | Description |
|---|---|---|
flow_name * | string | Flow name to look up |
get_flows_for_file
Get all flows for a file
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID |
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.
| Parameter | Type | Description |
|---|---|---|
milestone_id * | integer | Milestone ID |
get_flows_for_theme
Get all flows for a theme
| Parameter | Type | Description |
|---|---|---|
theme_id * | integer | Theme ID |
get_flows_from_directive
Get all flows originating from a directive (what comes next?). Returns raw flow data - AI evaluates conditions.
| Parameter | Type | Description |
|---|---|---|
from_directive * | string | Source directive name |
get_flows_to_directive
Get all directive flows leading to a directive (what leads here?). Useful for understanding directive prerequisites.
| Parameter | Type | Description |
|---|---|---|
to_directive * | string | Target directive name |
get_fp_directive_index
Get lightweight FP directive index grouped by category (names only, not full definitions)
get_from_core
Get records by ID(s), or all records if empty array
| Parameter | Type | Description |
|---|---|---|
id_array * | array | Array of integer IDs to fetch, **empty array [] returns ALL records** |
table * | string | Table name |
get_from_core_where
Flexible filtering with structured JSON conditions
| Parameter | Type | Description |
|---|---|---|
conditions * | object | Field-value pairs (AND logic), e.g., `{"type": "fp", "category": "purity"}` |
table * | string | Table name |
limit | integer | Maximum rows to return |
orderby | string | Sort order, e.g., "name ASC" or "id DESC" |
get_from_project
Get records by ID(s) - **EMPTY ARRAY NOT ALLOWED**
| Parameter | Type | Description |
|---|---|---|
id_array * | array | Array of integer IDs - **MUST contain at least one ID** |
table * | string | Table name |
get_from_project_where
Flexible filtering with structured JSON conditions
| Parameter | Type | Description |
|---|---|---|
conditions * | object | Field-value pairs (AND logic) |
table * | string | Table name |
limit | integer | Maximum rows to return |
orderby | string | Sort order |
get_from_settings
Get records by ID(s) - **EMPTY ARRAY NOT ALLOWED**
| Parameter | Type | Description |
|---|---|---|
id_array * | array | Array of integer IDs - **MUST contain at least one ID** |
table * | string | Table name |
get_from_settings_where
Flexible filtering with structured JSON conditions
| Parameter | Type | Description |
|---|---|---|
conditions * | object | Field-value pairs (AND logic) |
table * | string | Table name in user_preferences.db |
get_from_user_custom
Get records by ID(s) from user_directives.db - **EMPTY ARRAY NOT ALLOWED**
| Parameter | Type | Description |
|---|---|---|
id_array * | array | Array of integer IDs - **MUST contain at least one ID** |
table * | string | Table name in user_directives.db |
get_from_user_custom_where
Flexible filtering with structured JSON conditions on user_directives.db tables
| Parameter | Type | Description |
|---|---|---|
conditions * | object | Field-value pairs combined with AND logic |
table * | string | Table name in user_directives.db |
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.
| Parameter | Type | Description |
|---|---|---|
function_name * | string | Function name to look up |
details_only | boolean | If true, return only id/name + purpose/parameters/returns (when AI already has the rest) |
file_id | integer | Only the function defined in this tracked file. |
file_path | string | Only the function defined in this project-relative file (names are not unique across files). |
include_details | boolean | If false, omit purpose/parameters/returns for lightweight listing |
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.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to get functions for |
details_only | boolean | If true, return only id/name + purpose/parameters/returns (when AI already has the rest) |
include_details | boolean | If false, omit purpose/parameters/returns for lightweight listing |
get_git_status
Get comprehensive Git state snapshot (orchestrator)
get_helper_by_name
Get specific helper function details (high-frequency)
| Parameter | Type | Description |
|---|---|---|
helper_name * | string | Helper name to look up |
get_helpers_are_sub
Get all sub-helpers (is_sub_helper=true)
get_helpers_are_tool
Get all MCP tools (is_tool=true)
get_helpers_by_database
Get all helpers for a specific database
| Parameter | Type | Description |
|---|---|---|
target_database * | string | Database name ('core', 'project', 'settings', 'user_custom') |
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.
| Parameter | Type | Description |
|---|---|---|
directive_name * | string | Name of the directive to get helpers for |
include_helpers_data | boolean | If true, includes full helper_functions data |
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.
get_incomplete_completion_paths
Get all non-completed paths
get_incomplete_items
Get incomplete items for any parent type
| Parameter | Type | Description |
|---|---|---|
for_id * | integer | Parent ID |
for_table * | string | "tasks", "subtasks", "sidequests" (accepts singular) |
get_incomplete_milestones
Get all non-completed milestones
| Parameter | Type | Description |
|---|---|---|
detail_level | string | 'lean' (default): descriptions are null. 'full': descriptions included. |
include_task_counts | boolean | Attach task_counts to each milestone: {pending, in_progress, blocked, completed, total} (zeros included), from one grouped query. |
get_incomplete_sidequests
Get all non-completed sidequests
get_incomplete_subtasks
Get all non-completed subtasks
get_incomplete_subtasks_by_task
Get incomplete subtasks for specific task
| Parameter | Type | Description |
|---|---|---|
task_id * | integer | Task ID |
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.
| Parameter | Type | Description |
|---|---|---|
detail_level | string | 'lean' (default): descriptions are null. 'full': descriptions included. |
get_incomplete_tasks_by_milestone
Get open tasks for a milestone with related subtasks/sidequests
| Parameter | Type | Description |
|---|---|---|
milestone_id * | integer | ID of the milestone to query tasks for |
skip_pending | boolean | If true, excludes pending tasks |
get_infrastructure_by_type
Get all infrastructure of specific type
| Parameter | Type | Description |
|---|---|---|
type * | string | Infrastructure type (e.g., 'language', 'package', 'testing', 'database', 'build_tool') |
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.
| Parameter | Type | Description |
|---|---|---|
file_id | integer | File ID to look up interactions for |
file_ids | array | Several file IDs at once (combined with file_id): every edge touching any of them, each once, with source/target names and paths. |
get_interactions_by_function
Get all interactions for a function (both as source and target) — trace dependency graphs
| Parameter | Type | Description |
|---|---|---|
file_path | string | With function_name: only the function defined in this project-relative file. |
function_id | integer | Exact function ID (takes precedence over function_name). |
function_name | string | Function name to look up (all functions with that name unless file_path narrows it). |
get_items_for_sidequest
Get items for sidequest
| Parameter | Type | Description |
|---|---|---|
sidequest_id * | integer | Sidequest ID |
status | string | 'pending', 'in_progress', 'completed' (NULL = all) |
get_items_for_subtask
Get items for subtask
| Parameter | Type | Description |
|---|---|---|
subtask_id * | integer | Subtask ID |
status | string | 'pending', 'in_progress', 'completed' (NULL = all) |
get_items_for_task
Get items for task, optionally filtered by status
| Parameter | Type | Description |
|---|---|---|
task_id * | integer | Task ID |
status | string | 'pending', 'in_progress', 'completed' (NULL = all) |
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.
| Parameter | Type | Description |
|---|---|---|
branch | string | Optional source-branch filter (exact match on merge_history.source_branch and work_branches.branch_name) |
since | string | Optional ISO timestamp lower bound on merge_history.merge_timestamp (e.g. '2026-06-26') |
get_milestones_by_path
Get all milestones for a completion path
| Parameter | Type | Description |
|---|---|---|
completion_path_id * | integer | Completion path ID |
detail_level | string | 'lean' (default): descriptions are null. 'full': descriptions included. |
include_task_counts | boolean | Attach task_counts to each milestone: {pending, in_progress, blocked, completed, total} (zeros included), from one grouped query. |
get_milestones_by_status
Get milestones filtered by status
| Parameter | Type | Description |
|---|---|---|
status * | string | 'pending', 'in_progress', 'completed', 'blocked' |
detail_level | string | 'lean' (default): descriptions are null. 'full': descriptions included. |
include_task_counts | boolean | Attach task_counts to each milestone: {pending, in_progress, blocked, completed, total} (zeros included), from one grouped query. |
get_module_by_name
Get module by name. Returns module record with path, purpose, and external_dependencies.
| Parameter | Type | Description |
|---|---|---|
name * | string | Module name to look up |
get_module_by_path
Get module by directory path.
| Parameter | Type | Description |
|---|---|---|
path * | string | Directory path to look up |
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.
| Parameter | Type | Description |
|---|---|---|
module_id * | integer | Module ID |
get_module_files
Get all files assigned to a module via module_files junction table.
| Parameter | Type | Description |
|---|---|---|
module_id * | integer | Module ID |
get_module_for_file
Find which module a file belongs to. Reverse lookup via module_files junction table.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to look up |
get_module_functions
Get all functions in module files. Joins through module_files junction to files to functions.
| Parameter | Type | Description |
|---|---|---|
module_id * | integer | Module ID |
get_module_types
Get all types in module files. Joins through module_files junction to files to types.
| Parameter | Type | Description |
|---|---|---|
module_id * | integer | Module ID |
get_next_completion_path
Get lowest order_index with status != completed
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.
| Parameter | Type | Description |
|---|---|---|
directive_name | string | Filter by directive name |
exclude_note_types | array | List of note_type values to exclude from results (e.g., ['completed', 'obsolete']) |
limit | integer | Maximum notes returned, newest first (default: all) |
note_id | integer | Exact note ID — returns that single note with full content. Errors if not found or excluded by other filters |
note_type | string | Filter by note_type |
preview_chars | integer | Cap each note's content at this many characters (default: full content) |
reference_id | integer | Filter by reference ID |
reference_table | string | Filter by reference table |
severity | string | Filter by severity ('info', 'warning', 'error') |
source | string | Filter by source ('ai', 'user', 'directive') |
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.
| Parameter | Type | Description |
|---|---|---|
include_descriptions | boolean | Add truncated descriptions to each task, subtask and sidequest. Off keeps the payload small. |
milestone_id | integer | Limit to tasks of one milestone (and their subtasks and sidequests). Omit for all open work. |
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.
get_project
Get project metadata (single entry)
get_project_fields
Get field names and types for a specific table
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name to get fields for |
get_project_json_parameters
Get available fields for table to use with generic add/update operations
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name to get available fields for |
get_project_root
Get project root directory from infrastructure table
get_project_schema
Get complete schema for project database
get_project_tables
List all tables in project database
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.
| Parameter | Type | Description |
|---|---|---|
directive_id | integer | Filter to one directive, or omit for all |
limit | integer | Maximum records to return, newest first |
project_root | string | Project root; defaults to the session root |
get_settings_fields
Get field names and types for a specific table
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name to get fields for |
get_settings_json_parameters
Get available fields for table to use with generic add/update operations
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name to get available fields for |
get_settings_schema
Get complete schema for user settings database
get_settings_tables
List all tables in user settings database
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.
| Parameter | Type | Description |
|---|---|---|
sidequest_id * | integer | Sidequest ID |
get_sidequest_flows
Get flow IDs for a sidequest
| Parameter | Type | Description |
|---|---|---|
sidequest_id * | integer | Sidequest ID |
get_sidequests_comprehensive
Advanced sidequest search
| Parameter | Type | Description |
|---|---|---|
date_range_created | array | [start_date, end_date] |
date_range_updated | array | [start_date, end_date] |
limit | integer | Maximum results |
priority | string | 'low', 'medium', 'high', 'critical' |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = all) |
subtask_id | integer | Filter by paused subtask |
task_id | integer | Filter by paused task |
get_source_directory
Get project source directory from infrastructure table
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.
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.
| Parameter | Type | Description |
|---|---|---|
include_summary | boolean | Also return the themes/flows/paths/milestones map (default true) |
get_subtasks_by_task
Get subtasks for task, optionally filtered by status
| Parameter | Type | Description |
|---|---|---|
task_id * | integer | Task ID |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = all) |
get_subtasks_comprehensive
Advanced subtask search
| Parameter | Type | Description |
|---|---|---|
date_range_created | array | [start_date, end_date] |
date_range_updated | array | [start_date, end_date] |
limit | integer | Maximum results |
priority | string | 'low', 'medium', 'high', 'critical' |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = all) |
task_id | integer | Filter by task |
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.
| Parameter | Type | Description |
|---|---|---|
variant | string | Which context to load: 'core' (workflow, routing, edge cases — default), 'init' (discovery depth, initialization), 'coding' (file loop, DRY, interactions, types), 'case2' (Use Case 2 pipeline) |
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 prep…
| Parameter | Type | Description |
|---|---|---|
existing_content | string | Current text of the target instructions file (e.g. CLAUDE.md) if it already exists — read it and pass it in so the placement guidance can account for size/consolidation. Omit/empty if there is no ex… |
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.
| Parameter | Type | Description |
|---|---|---|
task_id * | integer | ID of the task/subtask/sidequest |
detail_level | string | 'lean' (default): the work item in full; items with descriptions only while open; flows id/name; files with their functions as id/name; modules id/name/path/purpose. 'full': every record as stored (fu… |
include_history | boolean | Include note history for task |
include_interactions | boolean | Include function dependency interactions |
task_type | string | Type of task: 'task', 'subtask', 'sidequest'. Auto-detected from task_id if omitted. |
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.
| Parameter | Type | Description |
|---|---|---|
task_id * | integer | Task ID |
get_task_flows
Get the architectural flow IDs for a task. Use to understand which part of the codebase a task touches and find relevant files.
| Parameter | Type | Description |
|---|---|---|
task_id * | integer | Task ID |
get_tasks_by_milestone
Get the tasks of a milestone (any status, or one status with status=...). Lean by default: descriptions null.
| Parameter | Type | Description |
|---|---|---|
milestone_id * | integer | Milestone ID |
detail_level | string | 'lean' (default): descriptions are null. 'full': descriptions included. |
status | string | Only tasks with this status. Omit for every status. |
get_tasks_comprehensive
Advanced task search with multiple filters
| Parameter | Type | Description |
|---|---|---|
date_range_created | array | [start_date, end_date] |
date_range_updated | array | [start_date, end_date] |
limit | integer | Maximum results |
milestone_id | integer | Filter by milestone |
priority | string | 'low', 'medium', 'high', 'critical' |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = all) |
get_theme_by_name
Get theme by name (fairly frequent)
| Parameter | Type | Description |
|---|---|---|
theme_name * | string | Theme name to look up |
get_themes_for_flow
Get all themes for a flow
| Parameter | Type | Description |
|---|---|---|
flow_id * | integer | Flow ID |
get_themes_for_path
Get the themes a completion path advances (id, name, description).
| Parameter | Type | Description |
|---|---|---|
completion_path_id * | integer | Completion path ID |
get_tracking_notes
Get tracking notes with optional filters
| Parameter | Type | Description |
|---|---|---|
directive_name | string | Filter by directive_name |
note_type | string | Filter by note_type |
reference_name | string | Filter by reference_name |
reference_type | string | Filter by reference_type |
severity | string | Filter by severity |
get_tracking_settings
Get all tracking feature flags
get_type_by_name
Look up a tracked type by name with full definition and file location — use BEFORE reading source files. Returns definition_json and description.
| Parameter | Type | Description |
|---|---|---|
type_name * | string | Type name to look up |
details_only | boolean | If true, return only id/name + definition_json/description/links (when AI already has the rest) |
include_details | boolean | If false, omit definition_json/description/links for lightweight listing |
get_unassigned_files
Find files not assigned to any module. Useful for identifying tracking gaps — domain logic files that should belong to a module but haven't been assigned.
get_user_custom_fields
Get field names and types for a specific table in user_directives.db
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name to get fields for |
get_user_custom_json_parameters
Get available fields for table to use with generic add/update operations. Returns field names, types, and whether required.
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name to get available fields for |
get_user_custom_schema
Get complete schema SQL for user directives database
get_user_custom_tables
List all tables in user directives database
get_user_directive_by_name
Get a single user directive by its unique name
| Parameter | Type | Description |
|---|---|---|
name * | string | Directive name (exact match) |
get_user_directive_notes
Get notes from user_directives.db with optional filters. All filters are AND logic. No filters returns all notes.
| Parameter | Type | Description |
|---|---|---|
exclude_note_types | array | List of note_type values to exclude from results (e.g., ['completed', 'obsolete']) |
limit | integer | Maximum number of notes to return (default 100) |
note_type | string | Filter by note_type |
reference_id | integer | Filter by reference_id |
reference_name | string | Filter by reference_name |
reference_type | string | Filter by reference_type |
severity | string | Filter by severity |
get_user_setting
Get project-wide user setting by key (fairly frequent)
| Parameter | Type | Description |
|---|---|---|
setting_key * | string | Setting key to retrieve |
get_user_settings
Get all user settings from user_settings table (complements get_user_setting which gets one setting by key)
get_wildcard_flows
Get all directive flows from wildcard '*' source (available from ANY context). Includes FP references, utilities, cross-cutting concerns.
| Parameter | Type | Description |
|---|---|---|
flow_type | string | Optional filter: 'reference_consultation', 'utility', 'conditional', etc. |
init_user_directives_db
Initialize user_directives.db for Case 2 (custom directive automation) projects. Creates the database from schema. Call when project transitions to Case 2.
link_files_to_task
Link files to a task, subtask, or sidequest (task_files junction) so get_task_context and get_task_files return them. 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. Use this for files worked on before the item was in_progress, or to correct a link.
| Parameter | Type | Description |
|---|---|---|
file_ids * | array | File IDs to link |
task_id * | integer | ID of the task, subtask, or sidequest |
task_type | string | 'task', 'subtask', or 'sidequest' (default 'task') |
list_active_branches
List all AIMFP work branches from work_branches table
list_project_backups
List available backup archives, newest first, with size, modification time, and which targets each one actually contains. Read-only. Call BEFORE restore_project_backup: a backup only holds databases that existed when it was taken, so an older archive may not carry every target you want.
load_directive_preferences
Load all active preferences for a directive (high-frequency)
| Parameter | Type | Description |
|---|---|---|
directive_name * | string | Directive name to load preferences for |
merge_worker_branch
(For use with InterCommAIMFP) ONE-CALL branch-ref merge orchestrator: takes a branch name and runs the whole documented sequence internally — export_state_changeset, optional source text-merge (keeping main's project.db, never blob-merging it), then apply_state_changeset — returning only a small result/conflict summary. The ~8k-token changeset never crosses the agent boundary, so a real fan-out stops serializing on the master hand-carrying blobs. Idempotent like apply; records a merge_history row; conflicts are still returned as structured data (never guessed). Mutates the working project.…
| Parameter | Type | Description |
|---|---|---|
branch * | string | Git ref of the worker branch to integrate, e.g. 'aimfp-alice-001' |
base_commit | string | 3-way base / branch point. Default = git merge-base(HEAD, branch) |
on_conflict | string | 'report' to apply DB state even if the source merge conflicts, or 'abort' to stop before applying |
source | string | 'auto' to also text-merge the branch's SOURCE into main (keeping main's project.db), or 'skip' to merge only DB state |
worker_id | string | Optional InterCommAIMFP worker identity (provenance + status hint) |
merge_worker_branches
(For use with InterCommAIMFP) Batch wrapper over merge_worker_branch: integrate a list of worker branches one at a time, each moving main forward and re-minting against the prior. 'additive-first' ordering lands the low-risk purely-additive branches before any structural/deleting ones. Each branch goes through the full export->source-merge->apply sequence; conflicts are surfaced per branch, never guessed.
| Parameter | Type | Description |
|---|---|---|
branches * | array | List of branch names (strings) or {branch, base_commit?, worker_id?} objects to integrate one at a time |
on_conflict | string | 'stop' to halt the batch on the first branch that returns conflicts, or 'continue' to integrate the rest |
order | string | 'as-listed' or 'additive-first' (branches with no delete/remove ops integrate first) |
migrate_databases
Migrate all pending project databases to current schema versions, in place. Per database: refuses if another connection has it open, write-locks it, keeps a pre-migration copy at <project folder>/backups/<db>_pre_migration_v<old>_<YYYYMMDD>.db (never overwriting an earlier copy), rebuilds it from the new schema SQL (shared columns via ATTACH), verifies row counts and atomically swaps the rebuilt file in. A count mismatch or any error leaves the original untouched (placed=false, error). Nothing is left in temp folders.
| Parameter | Type | Description |
|---|---|---|
aimfp_folder | string | AIMFP project directory name |
move_files_to_flow
Re-point many files from one flow to another in one transaction — the tool for splitting an oversized flow or retiring one. Moves links only; files are never touched. Files not in the source flow are skipped.
| Parameter | Type | Description |
|---|---|---|
file_ids * | array | Files to move |
from_flow_id * | integer | Flow they leave |
to_flow_id * | integer | Flow they join |
move_flows_to_theme
Re-point many flows from one theme to another in one transaction (e.g. when a theme is split or merged). Flows not in the source theme are skipped.
| Parameter | Type | Description |
|---|---|---|
flow_ids * | array | Flows to move |
from_theme_id * | integer | Theme they leave |
to_theme_id * | integer | Theme they join |
plan_disjoint_partitions
(For use with InterCommAIMFP) Compute DISJOINT file/module partitions so parallel workers don't overlap — the cheap complexity lever that converts most semantic conflicts into non-events. Only AIMFP can compute this well because it owns the function->function interaction graph and type-usage edges that define real dependency boundaries. Builds an undirected file-coupling graph (interaction edges + type-usage edges + module co-membership), takes connected components as atomic ownership units (never split), and bin-packs whole components into n_workers balanced partitions. Returns proposed per…
| Parameter | Type | Description |
|---|---|---|
n_workers | integer | Number of partitions to pack components into. Omit for one partition per connected component. |
targets | array | File paths, module names, or task/milestone slugs to partition. Omit to partition every tracked file. |
project_allowed_check_constraints
Returns list of allowed values for CHECK constraint enum fields in project.db. Parses schema to extract CHECK(field IN (...)) constraints.
| Parameter | Type | Description |
|---|---|---|
field * | string | Field name to get allowed values for |
table * | string | Table name to check for CHECK constraints |
query_core
Execute complex SQL WHERE clause (advanced, rare use)
| Parameter | Type | Description |
|---|---|---|
query * | string | WHERE clause without "WHERE" keyword |
table * | string | Table name |
query_project
Execute complex SQL WHERE clause (advanced, rare use)
| Parameter | Type | Description |
|---|---|---|
query * | string | WHERE clause without "WHERE" keyword |
table * | string | Table name |
query_project_state
Flexible SQL-like query interface for complex project queries. Provides powerful filtering and joining capabilities without writing raw SQL.
| Parameter | Type | Description |
|---|---|---|
entity * | string | Primary table to query: 'tasks', 'subtasks', 'sidequests', 'milestones', 'files', 'functions', 'flows', 'themes', etc. |
filters | object | WHERE-like conditions with operators: {field: value} or {field: {op: 'gt', value: 5}} |
joins | array | Relations to include via LEFT JOIN: ['milestones', 'files'] |
limit | integer | Maximum results (pagination) |
offset | integer | Skip first N results (pagination) |
sort | string | ORDER BY clause: 'field ASC' or 'field DESC' |
query_settings
Execute complex SQL WHERE clause (advanced, rare use)
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name in user_preferences.db |
where_clause | string | SQL WHERE clause for filtering |
query_user_custom
Execute complex SQL WHERE clause on user_directives.db (advanced, rare use)
| Parameter | Type | Description |
|---|---|---|
table * | string | Table name in user_directives.db |
where_clause | string | WHERE clause without 'WHERE' keyword |
reconcile_paths
Bring the tracking of changed files up to date in ONE call and one transaction (after a git pull, external edits, or edits made outside reserve/finalize). Per path: an untracked file is cataloged with its functions and types; a tracked file gets functions/types newly present in its source cataloged (existing rows and their prose are never touched) and those no longer in the source reported; a tracked file gone from disk is renamed as declared in renames, else to the one untracked path in the call with the same file name, else reported missing; a legacy row recorded at a folder path ('.' or a d…
| Parameter | Type | Description |
|---|---|---|
paths * | array | Project-relative paths of files that changed (e.g. from git diff --name-only, or the files you just edited). |
dry_run | boolean | Do everything, then roll back: the report is exactly what a real run would do. |
include_private | boolean | Also catalog _private functions and types (default true, like scan_source_tree). |
renames | array | Moves to apply first, as [{from, to}] project-relative paths. Needed when a file was renamed as well as moved; take them from git diff -M --name-status (R lines). Both paths are reconciled. |
remove_file_from_flow
Remove a file-flow link from the file_flows junction table. Use when reassigning a file to a different flow or preparing for file deletion.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to unlink |
flow_id * | integer | Flow ID to unlink from |
remove_file_from_module
Remove a file from a module. Deletes module_files junction entry. File itself is not deleted.
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to remove |
module_id * | integer | Module ID to remove from |
remove_files_from_module
Batch remove multiple files from modules. More efficient than multiple remove_file_from_module calls. Skips non-existent entries, reports modules left empty.
| Parameter | Type | Description |
|---|---|---|
links * | array | List of [file_id, module_id] tuples to remove |
remove_flow_themes
Batch-unlink flows from themes. A note is required. Refused (whole batch) if any flow would be left with no theme — link the replacement first, or use move_flows_to_theme.
| Parameter | Type | Description |
|---|---|---|
links * | array | Array of [flow_id, theme_id] pairs. One pair links one; many pairs (any mix of flow_ids) apply atomically. |
note_reason * | string | Why the links are removed (required; written as an entry_deletion note on each owner row) |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai', 'user', or 'directive' |
remove_milestone_flows
Batch-unlink milestones from flows. A note is required. Refused (whole batch) while an open task or sidequest of that milestone still lists the flow in its flow_ids — update those first.
| Parameter | Type | Description |
|---|---|---|
links * | array | Array of [milestone_id, flow_id] pairs. One pair links one; many pairs (any mix of milestone_ids) apply atomically. |
note_reason * | string | Why the links are removed (required; written as an entry_deletion note on each owner row) |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai', 'user', or 'directive' |
remove_path_themes
Batch-unlink completion paths from themes. A note is required.
| Parameter | Type | Description |
|---|---|---|
links * | array | Array of [completion_path_id, theme_id] pairs. One pair links one; many pairs (any mix of completion_path_ids) apply atomically. |
note_reason * | string | Why the links are removed (required; written as an entry_deletion note on each owner row) |
note_severity * | string | 'info', 'warning', 'error' |
note_source * | string | 'ai', 'user', or 'directive' |
reorder_all_completion_paths
Fix gaps and duplicates in order_index
reorder_completion_path
Change order_index for a completion path
| Parameter | Type | Description |
|---|---|---|
id * | integer | Completion path ID |
new_order_index * | integer | New order position |
reserve_file
Reserve a file ID before writing code, declaring the flow(s) it implements — part of the mandatory reserve-write-finalize tracking flow. flow_ids is required: a list of flows, or an explicit null for a file with no flow. Returns ID to embed in filename.
| Parameter | Type | Description |
|---|---|---|
flow_ids * | REQUIRED. Flow ID(s) this file implements (get_all_flows / get_task_flows / get_flows_for_milestone). Pass null EXPLICITLY only for a file that belongs to no flow (config, data, fixtures, package mark… | |
language * | string | Programming language (e.g., 'python', 'javascript', 'typescript') |
name * | string | Preliminary file name (will have _id_xxx appended) |
path * | string | File path relative to project root |
no_flow_reason | string | Why the file belongs to no flow (only with flow_ids=null), e.g. 'build config'. Recorded on the file so structure checks skip it. |
skip_id_naming | boolean | If true, skip ID embedding in name (for __init__.py, .db files, MCP tools, or user preference). Sets id_in_name=0 in database. |
reserve_files
Batch-reserve file IDs before writing code, each declaring the flow(s) it implements (flow_ids list, or explicit null for no flow). Atomic: all reserve or none.
| Parameter | Type | Description |
|---|---|---|
files * | array | Array of file objects [{name, path, language, flow_ids, skip_id_naming?, no_flow_reason?}, ...]. flow_ids is required per file: a list of flow IDs, or null explicitly for a file with no flow (config,… |
reserve_function
Reserve a function ID before writing code. Include purpose, parameters, and returns — null fields make functions invisible to future sessions.
| Parameter | Type | Description |
|---|---|---|
name * | string | Function name (will have _idxxx appended) |
file_id | integer | File ID where the function will be defined (or pass file_path) |
file_path | string | Project-relative path of the tracked file, instead of file_id (both given must agree) |
parameters | array | Function parameters |
purpose | string | Function purpose |
returns | object | Return value specification |
skip_id_naming | boolean | If true, skip ID embedding in name (for MCP tools, private functions excluded). Sets id_in_name=0 in database. |
reserve_functions
Batch-reserve function IDs before writing multiple functions. Include purpose/parameters/returns for every function.
| Parameter | Type | Description |
|---|---|---|
functions * | array | Array of function objects [{name, file_id | file_path, purpose, parameters, returns, skip_id_naming?}, ...] |
reserve_type
Reserve a type ID before writing the definition. Include definition_json and description — null fields force full file reads in future sessions.
| Parameter | Type | Description |
|---|---|---|
definition_json * | object | ADT definition (e.g., {'type': 'enum', 'variants': ['A', 'B']}) |
name * | string | Type name (will have _idxxx appended) |
description | string | Type description |
file_id | integer | File ID where type is defined |
links | object | Links to related functions |
skip_id_naming | boolean | If true, skip ID embedding in name. Sets id_in_name=0 in database. |
reserve_types
Batch-reserve type IDs before writing multiple type definitions. Include definition_json and description for every type.
| Parameter | Type | Description |
|---|---|---|
types * | array | Array of type objects [{name, definition_json, description, links, file_id, skip_id_naming?}, ...] |
restore_project_backup
Restore selected databases from a backup archive, side-by-side rather than in place. Every requested member is extracted to a temporary file FIRST; only once all extractions succeed is anything live touched. The current file is then moved into backups/ as 'replaced-<timestamp>-<filename>' and the restored copy moved into position. Nothing is ever deleted, so the displaced state remains recoverable.
| Parameter | Type | Description |
|---|---|---|
backup_name | string | Archive to restore from (e.g. 'aimfp-backup-2026-08-09.zip'). Defaults to the most recent. Get valid names from list_project_backups. |
databases | Which members to restore: any of 'project', 'user_preferences', 'user_directives', 'blueprint', or 'all'. Accepts a list or comma-separated string. Defaults to everything the archive contains. Be spec… |
scan_call_graph
Build the interaction graph for already-cataloged functions: which tracked function calls which. Read-only — returns tuples shaped for add_interactions, which does the writing. Run AFTER catalog_files and catalog_functions. Resolution is conservative and strictest-first (explicit import, then same-file, then module alias, then project-wide unique name), following re-export chains through modules that define no functions of their own. Ambiguous targets are dropped and counted rather than guessed at, because a wrong edge sends future refactors chasing dependencies that do not exist.
| Parameter | Type | Description |
|---|---|---|
module_path | string | Project-relative subtree to limit analysis to. Only the CALLING side is narrowed — functions outside it still resolve as targets, so cross-module edges are never lost. |
scan_source_tree
Read-only inventory of an existing codebase for adoption into AIMFP tracking. Walks source_directory applying the watchdog's exact exclusion stack (built-in exclusions + watchdog_excluded_* settings + .watchdogignore), extracts signatures, and reports tracked vs untracked. Writes nothing — review the inventory, then register with catalog_files/catalog_functions/catalog_types.
| Parameter | Type | Description |
|---|---|---|
include_nested | boolean | Include functions defined inside other functions |
include_private | boolean | Include underscore-prefixed functions and types |
module_path | string | Project-relative subtree to narrow the scan to (e.g. 'src/aimfp/helpers/project'). Defaults to the whole source_directory. Use this to adopt a large codebase one module at a time. |
untracked_only | boolean | Report only files with no existing database record. Use on re-scans to see just what is new. |
search_directives
Find directives by type, category, or keyword when you know the domain but not the exact directive name. Multi-word input is split into words; a row matches if ANY word prefix-matches ("disk space free" finds get_free_disk_space). Rows matching more words rank first. Punctuation is ignored, so no FTS syntax is needed or honored. Common stopwords (the, of, and, ...) are ignored unless the query is nothing but stopwords. Keyword results are ordered by name/description relevance.
| Parameter | Type | Description |
|---|---|---|
category | string | Directive category filter (e.g., 'purity', 'error_handling', 'task_management') |
keyword | string | Free-text search over directive names, descriptions, and intent keywords, one or more words (e.g. 'task decomposition') |
type | string | Directive type filter: 'fp', 'project', 'user-system', 'user-pref', 'git' |
search_functions
Search tracked functions by name or purpose with relevance ranking. Multi-word input is split into words; a row matches if ANY word prefix-matches ("disk space free" finds get_free_disk_space). Rows matching more words rank first. Punctuation is ignored, so no FTS syntax is needed or honored. Common stopwords (the, of, and, ...) are ignored unless the query is nothing but stopwords. Results are capped by limit; total_count reports all matches.
| Parameter | Type | Description |
|---|---|---|
search_string * | string | Free-text search over function name and purpose, one or more words (e.g. 'disk space free') |
details_only | boolean | If true, return only id/name + purpose/parameters/returns |
include_details | boolean | If false, omit purpose/parameters/returns for lightweight listing |
limit | integer | Maximum functions returned, best matches first (default 20) |
search_modules
Search modules by name, purpose, or description with relevance ranking. Multi-word input is split into words; a row matches if ANY word prefix-matches ("disk space free" finds get_free_disk_space). Rows matching more words rank first. Punctuation is ignored, so no FTS syntax is needed or honored. Common stopwords (the, of, and, ...) are ignored unless the query is nothing but stopwords. Results are capped by limit; total_count reports all matches.
| Parameter | Type | Description |
|---|---|---|
search_string * | string | Free-text search over module name, purpose, and description, one or more words |
detail_level | string | 'lean' (default): description is null, purpose kept. 'full': description included. |
limit | integer | Maximum modules returned, best matches first (default 20) |
search_notes
Search past decisions and context by keyword. Multi-word input is split into words; a row matches if ANY word prefix-matches ("disk space free" finds get_free_disk_space). Rows matching more words rank first. Punctuation is ignored, so no FTS syntax is needed or honored. Common stopwords (the, of, and, ...) are ignored unless the query is nothing but stopwords. Returns capped previews by default; read a note in full with get_notes_comprehensive(note_id=X).
| Parameter | Type | Description |
|---|---|---|
search_string * | string | Free-text search over note content, one or more words (e.g. 'hash digest') |
directive_name | string | Optional filter by directive name |
exclude_note_types | array | List of note_type values to exclude from results (e.g., ['completed', 'obsolete']) |
limit | integer | Maximum notes returned, best matches first (default 20) |
note_type | string | Optional filter by note_type |
preview_chars | integer | Cap each note's content at this many characters (default 300; 0 = full content) |
reference_id | integer | Optional filter by reference ID |
reference_table | string | Optional filter by reference table |
severity | string | Optional filter by severity |
source | string | Optional filter by source |
search_tracking_notes
Search tracking note content with optional filters
| Parameter | Type | Description |
|---|---|---|
search_string * | string | Search string for note content |
directive_name | string | Optional filter by directive_name |
note_type | string | Optional filter by note_type |
reference_type | string | Optional filter by reference_type |
search_types
Search tracked types by name or description with relevance ranking. Multi-word input is split into words; a row matches if ANY word prefix-matches ("disk space free" finds get_free_disk_space). Rows matching more words rank first. Punctuation is ignored, so no FTS syntax is needed or honored. Common stopwords (the, of, and, ...) are ignored unless the query is nothing but stopwords. Results are capped by limit; total_count reports all matches.
| Parameter | Type | Description |
|---|---|---|
search_string * | string | Free-text search over type name and description, one or more words |
details_only | boolean | If true, return only id/name + definition_json/description/links |
include_details | boolean | If false, omit definition_json/description/links for lightweight listing |
limit | integer | Maximum types returned, best matches first (default 20) |
search_user_directive_notes
Search note content in user_directives.db with optional additional filters
| Parameter | Type | Description |
|---|---|---|
search_string * | string | Search string for note content (case-insensitive LIKE match) |
exclude_note_types | array | List of note_type values to exclude from results (e.g., ['completed', 'obsolete']) |
limit | integer | Maximum number of notes to return (default 100) |
note_type | string | Optional filter by note_type |
reference_type | string | Optional filter by reference_type |
severity | string | Optional filter by severity |
search_user_directives
Search user directives with optional filters. At least one filter required.
| Parameter | Type | Description |
|---|---|---|
domain | string | Filter by domain (exact match, e.g. 'home_automation', 'aws_infrastructure') |
name | string | Filter by directive name (LIKE match, case-insensitive) |
source_file | string | Filter by source_file path (LIKE match) |
status | string | Filter by status (exact match) |
trigger_type | string | Filter by trigger_type (exact match) |
set_custom_return_statement
Add a custom return statement for a helper function. Extends core return_statements with user-defined guidance, context, or preferences. To modify: delete first, then set new statement.
| Parameter | Type | Description |
|---|---|---|
helper_name * | string | Helper function name (should match aimfp_core.db helper_functions.name) |
statement * | string | Custom return statement text |
active | boolean | Whether statement is active (default true) |
description | string | Why this was added (optional context) |
summarize_state_changeset
(For use with InterCommAIMFP) Cheap, low-token counts summary of ONE branch's changeset — add/modify/delete per entity kind, add/remove per reference kind, touched files/modules, and warning count — WITHOUT returning the full ~8k-token object. Affordable to read for every pending branch before deciding apply order. Identify the changeset by changeset_id (loads the persisted artifact) or by branch+base_commit (re-exports). Pure read.
| Parameter | Type | Description |
|---|---|---|
base_commit | string | 3-way base / branch point (used with branch) |
branch | string | Git ref whose changeset to summarize (requires base_commit) |
changeset_id | string | Handle from a prior export_state_changeset (loads the persisted artifact, no git work) |
swap_completion_paths_order
Swap order_index of two completion paths
| Parameter | Type | Description |
|---|---|---|
id1 * | integer | First completion path ID |
id2 * | integer | Second completion path ID |
sync_git_state
Update project.last_known_git_hash with current Git HEAD
toggle_tracking_feature
Enable/disable tracking feature
| Parameter | Type | Description |
|---|---|---|
enabled * | boolean | Enable or disable |
feature_name * | string | Tracking feature name |
unlink_files_from_task
Remove file links from a task, subtask, or sidequest — e.g. a file auto-linked to the wrong in_progress item. Does not touch the files.
| Parameter | Type | Description |
|---|---|---|
file_ids * | array | File IDs to unlink |
task_id * | integer | ID of the task, subtask, or sidequest |
task_type | string | 'task', 'subtask', or 'sidequest' (default 'task') |
update_completion_path
Update completion path
| Parameter | Type | Description |
|---|---|---|
id * | integer | Completion path ID |
description | string | New description (NULL = don't update) |
name | string | New name (NULL = don't update) |
status | string | 'pending', 'in_progress', 'completed' (NULL = don't update) |
update_directive_preference
Update existing directive preference in directive_preferences table
| Parameter | Type | Description |
|---|---|---|
directive_name * | string | Directive name |
preference_key * | string | Preference key to update (must exist) |
active | boolean | Update active status |
description | string | Update description |
preference_value | string | New preference value |
update_file
Update file metadata
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID to update |
language | string | Language (NULL = don't update) |
name | string | New file name (NULL = don't update) |
no_flow_reason | string | Mark the file as belonging to no flow, with why (config, data) — structure checks then skip it. Empty string clears it (NULL = don't update). |
path | string | New file path (NULL = don't update) |
update_flow
Update flow metadata
| Parameter | Type | Description |
|---|---|---|
flow_id * | integer | Flow ID to update |
confidence_score | number | New confidence score (NULL = don't update) |
description | string | What the flow does now; replaces the old text. Not an evolution log: history goes in add_note(note_type='evolution') (NULL = don't update) |
name | string | New name (NULL = don't update) |
update_function
Update function metadata
| Parameter | Type | Description |
|---|---|---|
function_id * | integer | Function ID to update |
name | string | New function name (NULL = don't update) |
parameters | array | New parameters (NULL = don't update) |
purpose | string | New purpose (NULL = don't update) |
returns | object | New return specification (NULL = don't update) |
update_function_file_location
Move function to different file (rarely used)
| Parameter | Type | Description |
|---|---|---|
function_id * | integer | Function ID to move |
new_file_id * | integer | New file ID |
old_file_id * | integer | Current file ID |
update_functions_for_file
Update multiple functions in a single file
| Parameter | Type | Description |
|---|---|---|
file_id * | integer | File ID |
functions * | array | Array of function update objects [{function_id, name, purpose, parameters, returns}, ...] |
update_interaction
Update interaction metadata
| Parameter | Type | Description |
|---|---|---|
interaction_id * | integer | Interaction ID to update |
description | string | New description (NULL = don't update) |
interaction_type | string | 'call', 'chain', 'borrow', 'compose', 'pipe' (NULL = don't update) |
is_indirect | boolean | Mark (true) or clear (false) the deliberate-indirect flag (NULL = don't update). True for a deliberate edge the code makes indirectly (dispatch through a tuple/table of functions, a chain data-flow li… |
source_function_id | integer | New source (NULL = don't update) |
target_function_id | integer | New target (NULL = don't update) |
update_item
Update a single item's status, name, or description. Primary use: marking items in_progress or completed as work progresses.
| Parameter | Type | Description |
|---|---|---|
id * | integer | Item ID |
description | string | New description (NULL = don't update) |
name | string | New name (NULL = don't update) |
status | string | 'pending', 'in_progress', 'completed' (NULL = don't update) |
update_items
Batch-update multiple items with the same field values. Primary use: marking multiple items completed at once when parent completes.
| Parameter | Type | Description |
|---|---|---|
data * | object | Field-value pairs to apply to all items (e.g., {status: 'completed'}) |
ids * | array | Array of item IDs to update |
reference_id * | integer | ID of the parent task, subtask, or sidequest that owns every item in ids |
reference_table * | string | Parent the items must belong to: 'tasks', 'subtasks', or 'sidequests' |
update_milestone
Update milestone status, name, or description. When completing, check if all milestones in the path are done to cascade completion.
| Parameter | Type | Description |
|---|---|---|
id * | integer | Milestone ID |
completion_path_id | integer | New completion path ID (NULL = don't update) |
description | string | New description (NULL = don't update) |
name | string | New name (NULL = don't update) |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = don't update) |
update_module
Update module metadata. Only non-None fields are updated.
| Parameter | Type | Description |
|---|---|---|
module_id * | integer | Module ID to update |
description | string | New description |
external_dependencies | array | New dependencies list |
name | string | New name |
path | string | New path |
purpose | string | New purpose |
update_note
Update note metadata
| Parameter | Type | Description |
|---|---|---|
id * | integer | Note ID to update |
content | string | Update note content |
directive_name | string | Update directive name |
note_type | string | Update note_type |
reference_id | integer | Update reference ID |
reference_table | string | New reference table (NULL = don't update). The project.db table the note is attached to (e.g. 'files', 'tasks', 'flows', 'completion_path'). Must be an existing project.db table name, exactly: unknown… |
send_with_directive | boolean | Update send_with_directive flag. If true and directive_name set, note is included when that directive is retrieved. |
severity | string | Update severity |
source | string | Update source |
update_project
Update project metadata
| Parameter | Type | Description |
|---|---|---|
goals | array | Array of goal strings (NULL = don't update) |
name | string | Project name (NULL = don't update) |
purpose | string | Project purpose (NULL = don't update) |
status | string | 'active', 'paused', 'completed', 'abandoned' (NULL = don't update) |
user_directives_status | string | NULL, 'pending_discovery', 'pending_parse', 'in_progress', 'active', 'disabled' (NULL = don't update) |
version | integer | Version number (NULL = don't update) |
update_project_entry
Update existing entry
| Parameter | Type | Description |
|---|---|---|
data * | object | Field-value pairs to update |
id * | integer | Record ID |
table * | string | Table name |
update_project_root
Update project root in infrastructure table. Failsafe: Inserts if not exists (should never happen, initialized by SQL).
| Parameter | Type | Description |
|---|---|---|
new_project_root * | string | New project root path (absolute path) |
update_project_state
Orchestrated state change for tasks, milestones, and paths. Maps actions (start_task, complete_task, block_task, etc.) to correct status updates and note creation.
| Parameter | Type | Description |
|---|---|---|
action * | string | Operation: 'start_task', 'complete_task', 'pause_task', 'resume_task', 'block_task', 'unblock_task', 'start_subtask', 'complete_subtask', etc. |
target_id * | integer | ID of target entity |
target_type * | string | Entity type: 'task', 'subtask', 'sidequest', 'milestone', 'completion_path' |
create_note | boolean | Auto-log action as note in notes table |
data | object | Action-specific data (e.g., blocked_by, completion_notes) data.audit_override_reason completes a task/subtask/sidequest despite blocking tracking-audit findings (recorded as a warning note); completio… |
update_settings_entry
Update entry in user settings database
| Parameter | Type | Description |
|---|---|---|
data * | object | Field-value pairs to update |
record_id * | integer | Record ID to update |
table * | string | Table name in user_preferences.db |
update_sidequest
Update sidequest metadata
| Parameter | Type | Description |
|---|---|---|
id * | integer | Sidequest ID |
audit_override_reason | string | Complete despite blocking tracking-audit findings in the linked files. Recorded as a warning note with the outstanding counts; use only when the drift is understood and will be fixed in follow-up work… |
description | string | New description (NULL = don't update) |
flow_ids | array | Array of flow IDs (NULL = don't update) |
name | string | New name (NULL = don't update) |
paused_subtask_id | integer | New paused subtask ID (NULL = don't update) |
paused_task_id | integer | New paused task ID (NULL = don't update) |
priority | string | 'low', 'medium', 'high', 'critical' (NULL = don't update) |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = don't update) |
update_source_directory
Update existing source directory in infrastructure table
| Parameter | Type | Description |
|---|---|---|
new_source_dir * | string | New source directory path |
update_subtask
Update subtask metadata
| Parameter | Type | Description |
|---|---|---|
id * | integer | Subtask ID |
audit_override_reason | string | Complete despite blocking tracking-audit findings in the linked files. Recorded as a warning note with the outstanding counts; use only when the drift is understood and will be fixed in follow-up work… |
description | string | New description (NULL = don't update) |
name | string | New name (NULL = don't update) |
priority | string | 'low', 'medium', 'high', 'critical' (NULL = don't update) |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = don't update) |
task_id | integer | New task ID (NULL = don't update) |
update_task
Update task metadata
| Parameter | Type | Description |
|---|---|---|
id * | integer | Task ID |
audit_override_reason | string | Complete despite blocking tracking-audit findings in the linked files. Recorded as a warning note with the outstanding counts; use only when the drift is understood and will be fixed in follow-up work… |
description | string | New description (NULL = don't update) |
flow_ids | array | Array of flow IDs [1, 3, 5] (NULL = don't update) |
milestone_id | integer | New milestone ID (NULL = don't update) |
name | string | New name (NULL = don't update) |
priority | string | 'low', 'medium', 'high', 'critical' (NULL = don't update) |
status | string | 'pending', 'in_progress', 'completed', 'blocked' (NULL = don't update) |
update_theme
Update theme metadata
| Parameter | Type | Description |
|---|---|---|
theme_id * | integer | Theme ID to update |
confidence_score | number | New confidence score (NULL = don't update) |
description | string | New description (NULL = don't update) |
name | string | New name (NULL = don't update) |
update_type
Update type metadata
| Parameter | Type | Description |
|---|---|---|
type_id * | integer | Type ID to update |
definition_json | object | New definition (NULL = don't update) |
description | string | New description (NULL = don't update) |
file_id | integer | New file_id (NULL = don't update) |
name | string | New name (NULL = don't update) |
update_type_function_role
Update relationship role only
| Parameter | Type | Description |
|---|---|---|
function_id * | integer | Function ID |
role * | string | 'factory', 'transformer', 'operator', 'pattern_matcher', 'accessor', 'validator', 'combinator' |
type_id * | integer | Type ID |
update_user_custom_entry
Update entry in user_directives.db table. Every key must be a column of the table (compared without case). On user_directives the approval columns (approved, approved_at, approved_by, approval_hash) and status='active' are refused: approval is a person's decision, recorded by the user's own path (`aimfp directives approve`, or a host calling aimfp.hooks.approval), and activation goes through activate_user_directive.
| Parameter | Type | Description |
|---|---|---|
data * | object | Field-value pairs to update |
record_id * | integer | Record ID to update |
table * | string | Table name in user_directives.db |
update_user_setting
Update existing project-wide user setting in user_settings table
| Parameter | Type | Description |
|---|---|---|
setting_key * | string | Setting key to update (must exist) |
description | string | New description (optional) |
scope | string | New scope (optional) |
setting_value | string | New setting value |
user_directives_allowed_check_constraints
Returns list of allowed values for CHECK constraint enum fields in user_directives.db. Parses schema to extract CHECK(field IN (...)) constraints.
| Parameter | Type | Description |
|---|---|---|
field * | string | Field name to get allowed values for |
table * | string | Table name to check for CHECK constraints |
user_preferences_allowed_check_constraints
Returns list of allowed values for CHECK constraint enum fields in user_preferences.db. Parses schema to extract CHECK(field IN (...)) constraints.
| Parameter | Type | Description |
|---|---|---|
field * | string | Field name to get allowed values for |
table * | string | Table name to check for CHECK constraints |
validate_action_config
Checks an action_config against AIMFP's envelope for its action_type BEFORE the row is written; add_user_custom_entry and update_user_custom_entry refuse a non-conforming config. AIMFP validates the ENVELOPE ONLY. api_call, script_execution and notification are generic, so AIMFP can specify them fully. function_call and command name a target that exists in the caller's own project, so AIMFP checks that a target is named and well-formed but never that it resolves - caller_resolved=true marks exactly that, and means 'the shape is right, now check it resolves'. Unknown keys are errors, not ignore…
| Parameter | Type | Description |
|---|---|---|
action_config * | object | The config to check, as an object or a JSON string |
action_type * | string | 'api_call', 'script_execution', 'function_call', 'command', or 'notification' |
validate_trigger_config
Checks a trigger_config against AIMFP's grammar for its trigger_type BEFORE the row is written. add_user_custom_entry and update_user_custom_entry refuse a non-conforming config, so calling this first turns a rejected insert into a fixed config. Time triggers are a discriminated union on 'kind' (interval/daily/weekly/monthly); event, condition and manual have fixed shapes. Unknown keys are errors, not ignored - a typo'd schedule key is the silent failure this exists to surface, because a schedule that never fires produces no log line and no recorded error. On failure, errors names every offend…
| Parameter | Type | Description |
|---|---|---|
trigger_config * | object | The config to check, as an object or a JSON string |
trigger_type * | string | 'time', 'event', 'condition', or 'manual' |
verify_fanout_ready
(For use with InterCommAIMFP) Pre-fan-out preflight on current main: cheap insurance against silent fan-out corruption. Asserts (a) every relevant row has a stable identity key (hierarchy slugs + function/type entity_key — i.e. backfill_semantic_keys has nothing left to do), (b) .aimfp-project/project.db is committed (clean working tree for that path) so every clone shares the same base, and (c) no schema migration is pending. Returns {ready, blockers}. Run on main BEFORE spawning workers. Pure read.