← Files 101ARCHIVED FILE

skills/shared-resources/data-import-rules.md

3.8 KB · Nov 28, 2026 · 18:12 UTC

↓ Download file

# Import Rules

`data-import`: one external source → one current company, `whoami.is_owner=true`, an explicit request, and a confirmed preview. The source does not become authoritative; an omission in it does not authorize deletion in 101. Do not turn importing one entity into a full migration.

## Source and matching

- Use supplied files, an authorized connection, an official export, or an API. Parse simple CSV directly and a complex table through available Spreadsheets; do not copy its code or resources into 101. If required reading is unavailable, state that limitation and preserve progress.
- The source file is input for analysis; do not upload it or attached documents from the previous system into 101 as part of transferring accounting records.
- Reuse one exact match in the target company; if none exists, offer creation. Clarify similar or multiple matches, missing required data, and contradictions.
- Skip proven identical items. Show a difference in an existing record and obtain separate explicit permission to update it; a new run requires a new comparison.

## Blocks and meaning

- Build the dependency order: shared company entities once, then the project, articles, counterparties, and events. Unresolved ambiguity holds the dependent block; independent blocks may proceed after their own complete check.
- Use domain workflows and current commands. Never invent missing methods, batch formats, or relationships.
- For one estimate, determine the project from the source and context; otherwise, ask. Match rows to articles and stages; show the structure before sequential `create_estimate` calls.
- Preserve explicit dates, amounts, units, and valid sources. Historical expense rows use manual positions without artificial `sources`, price lists, or estimates. An explicit price-list or estimate import is a separate input type.
- With a complete positions list, its sum takes precedence over an erroneous total: show the original and recalculated totals and agree the correction. If completeness is unproven, stop; never invent an adjustment row.
- Take the date from the source operation, not the import day or file date. Agree a missing date. Never invent opening-balance history: offer a note or a separately agreed event with type, date, people, and relationships.
- Offer to place general business expenses in the fund. Clarify project-versus-fund ambiguity; a transfer between them requires access to both sides.
- Never silently choose how to handle an unsupported field: show the affected meaning and offer a description, another entity, or omission.
- Do not automatically select people, invitations, or roles. A financial counterparty does not mean an invited participant; inviting requires a separate decision and an available command.
- Offer the `Import` tag once; add it only after agreement and through the standard method.

## Writing and recovery

Block preview: company, project, counts, amounts, corrections, conflicts, and consequences. The owner's consent covers only the displayed block and does not replace server confirmation. Before every command, check current permissions, the schema, `entity-resolution`, and `write-preflight`.

`create_expense`, `create_estimate`, `create_income`, and `create_payment_record` create `NOT_VERIFIED` and do not accept a confirmed status. Bulk confirmation is unavailable; events do not yet enter confirmed balances.

Maintain a ledger for every call: created, not created, not started, outcome unknown; preserve receipts. Continue from the ledger. After losing context, obtain the source again and reread 101: skip identical items, prove absence, and resolve differences and unknowns before writing.

Return results by block, including agreed changes, reused items, and omissions. There is no shared transaction or automatic rollback. The external-migration boundary is in `safety-and-permissions.md`.

SHA-256: 1de1188220e3e2dc4b606073f6034ac11bdfbdfcbfe2fdc83e87a7a3afebc8f5