docs(prd): ADC framework — accounting decision records + STATUS cold-reader polish #26

Merged
arcodange merged 2 commits from arcodange/adc-framework into main 2026-07-12 14:22:38 +02:00
2 changed files with 39 additions and 9 deletions
+8 -8
View File
@@ -12,21 +12,21 @@
| Phase | Scope | State | | Phase | Scope | State |
| --- | --- | --- | | --- | --- | --- |
| 0 — Foundations | read skills, sandbox + promote, backups, snapshots, bank reco, email ingest, Telegram gateway MVP | ✅ shipped pre-PRD (ledger below) | | 0 — Foundations | read skills, sandbox + promote, backups, snapshots, bank reco, email ingest, Telegram gateway MVP | ✅ shipped pre-PRD (ledger below) |
| 1 — Flagship pipeline | [POC-1](poc-plan.md#poc-1--supplier-invoice-end-to-end) + [POC-5](poc-plan.md#poc-5--model-routing-bench) | ⬜ decomposed → [erp milestone P1](https://gitea.arcodange.lab/arcodange-org/erp/milestone/1) (erp#3845, #47) | | 1 — Flagship pipeline | [POC-1](poc-plan.md#poc-1--supplier-invoice-end-to-end) + [POC-5](poc-plan.md#poc-5--model-routing-bench) | ⬜ decomposed → [erp milestone P1](https://gitea.arcodange.lab/arcodange-org/erp/milestone/1) (erp#3845, #47 — due 2026-10-09) |
| 2 — Urgent compliance | [POC-6](poc-plan.md#poc-6--e-invoicing-readiness-spike) — **hard deadline 2026-09-01** | ⬜ decomposed → [erp milestone P2](https://gitea.arcodange.lab/arcodange-org/erp/milestone/2) (erp#46) | | 2 — Urgent compliance | [POC-6](poc-plan.md#poc-6--e-invoicing-readiness-spike) — **hard deadline 2026-09-01** | ⬜ decomposed → [erp milestone P2](https://gitea.arcodange.lab/arcodange-org/erp/milestone/2) (erp#46 — due 2026-09-01) |
| 3 — Standing fleet | [POC-2](poc-plan.md#poc-2--pi-sentinel), queue, digest + approval cards | ⬜ decomposed → [erp milestone P3](https://gitea.arcodange.lab/arcodange-org/erp/milestone/3) (erp#4850, #59) + [gateway#1](https://gitea.arcodange.lab/arcodange/telegram-gateway/issues/1)/[#2](https://gitea.arcodange.lab/arcodange/telegram-gateway/issues/2) | | 3 — Standing fleet | [POC-2](poc-plan.md#poc-2--pi-sentinel), queue, digest + approval cards | ⬜ decomposed → [erp milestone P3](https://gitea.arcodange.lab/arcodange-org/erp/milestone/3) (erp#4850, #59 — due 2026-11-13) + [gateway#1](https://gitea.arcodange.lab/arcodange/telegram-gateway/issues/1)/[#2](https://gitea.arcodange.lab/arcodange/telegram-gateway/issues/2) |
| Ledger compliance (cross-cutting) | [Dolibarr verifications](compliance.md#dolibarr-verifications-sandbox-first) | ⬜ decomposed → [erp milestone](https://gitea.arcodange.lab/arcodange-org/erp/milestone/4) (erp#51) | | Ledger compliance (cross-cutting) | [Dolibarr verifications](compliance.md#dolibarr-verifications-sandbox-first) | ⬜ decomposed → [erp milestone](https://gitea.arcodange.lab/arcodange-org/erp/milestone/4) (erp#51 — due 2026-11-27) |
| 4 — Money loops | [POC-3](poc-plan.md#poc-3--reconciliation--payment-recording), dunning, cash report | ⬜ decomposed → [erp milestone P4](https://gitea.arcodange.lab/arcodange-org/erp/milestone/5) (erp#5253) | | 4 — Money loops | [POC-3](poc-plan.md#poc-3--reconciliation--payment-recording), dunning, cash report | ⬜ decomposed → [erp milestone P4](https://gitea.arcodange.lab/arcodange-org/erp/milestone/5) (erp#5253 — due 2026-12-24) |
| 5 — Fiscal autopilot | [POC-4](poc-plan.md#poc-4--tva-dry-run), compliance calendar | ⬜ decomposed → [erp milestone P5](https://gitea.arcodange.lab/arcodange-org/erp/milestone/6) (erp#5455, #60) | | 5 — Fiscal autopilot | [POC-4](poc-plan.md#poc-4--tva-dry-run), compliance calendar | ⬜ decomposed → [erp milestone P5](https://gitea.arcodange.lab/arcodange-org/erp/milestone/6) (erp#5455, #60 — due 2027-05-04) |
| 6 — Emission era | e-invoice emission + e-reporting — **hard deadline 2027-09-01** | ⬜ not yet decomposed (starts 2027-05; requirements captured by erp#46 deliverable 4) | | 6 — Emission era | e-invoice emission + e-reporting — **hard deadline 2027-09-01** | ⬜ not yet decomposed (starts 2027-05; requirements captured by erp#46 deliverable 4) |
## Backlog map ## Backlog map
Every phase is decomposed into **self-contained issues** (context, deliverables, acceptance criteria, dependencies, PRD links); since 2026-07-12 each issue also carries an **Execution footer***Blocked by / Blocks / Human gates / Start (worktree + first command) / Done means (evidence comment → PR with `Closes #N` → doc sweep)*. How a future session resumes: **order open milestones by due date, pick the top issue whose "Blocked by" is clear — and skip issues whose only open step is a `[HUMAN]` gate** (surface those in the digest instead of stalling on them; e.g. erp#46 step 1 is operator-owned). Cold-start entry points as of 2026-07-12: **erp#38** (the fleet entry issue), **erp#51** (startable today), **erp#41/#42/#43/#44** (write-skill side, independent of the scaffold). The issue body carries everything; on any doubt the trust order is live system > code > STATUS > leaves. Cross-cutting decisions get their ADRs via [factory#22](https://gitea.arcodange.lab/arcodange-org/factory/issues/22). Every phase is decomposed into **self-contained issues** (context, deliverables, acceptance criteria, dependencies, PRD links); since 2026-07-12 each issue also carries an **Execution footer***Blocked by / Blocks / Human gates / Start (worktree + first command) / Done means (evidence comment → PR with `Closes #N` → doc sweep)*. How a future session resumes: **order open milestones by due date, pick the top issue whose "Blocked by" is clear — and skip issues whose only open step is a `[HUMAN]` gate** (surface those in the digest instead of stalling on them; e.g. erp#46 step 1 is operator-owned). Cold-start entry points as of 2026-07-12: **erp#38** (the fleet entry issue), **erp#51** (startable today), **erp#41/#42/#43/#44** (write-skill side, independent of the scaffold). **Arbitration: one session = one lane** — take the entry issue; an orchestrator may fan the independent lanes out in parallel (#38#51#4144 touch disjoint directories); everything else follows due-date order (dates in the phase tracker above). The issue body carries everything; on any doubt the trust order is live system > code > STATUS > leaves. Cross-cutting decisions get their ADRs via [factory#22](https://gitea.arcodange.lab/arcodange-org/factory/issues/22).
| Repo | Issues | | Repo | Issues |
| --- | --- | | --- | --- |
| [erp](https://gitea.arcodange.lab/arcodange-org/erp/issues) | **P1:** #38 fleet scaffold+AGENTS.md (D8, **entry issue**) · #39 golden set+injection fixtures · #40 invoice-extract atom · #41 provenance checker · #42 compliance linter · #43 GED attach op · #44 idempotency keys · #45 POC-5 routing bench (D5) · #47 POC-1 exit gate (umbrella) — **P2:** #46 POC-6 Qonto-as-PA (D4; step 1 = [HUMAN] Qonto UI) — **P3:** #48 T13 drift watchdog · #59 T14 backup freshness+drill · #49 T17 second-brain hooks (D7; meeting lane D9 parked) · #50 POC-2 Pi sentinel (D6) — **Compliance:** #51 Dolibarr verifications (FEC/BlockedLog, startable today) — **P4:** #52 POC-3 reco+payments · #53 T05 client invoice (D3, ⚠️ July manual ~07-23) — **P5:** #54 fiscal profile+calendar files · #60 T11 reminder loop · #55 POC-4 TVA dry-runs — **Ops (post-replay):** #56 known-patterns fix · #57 bucket C + document gaps | | [erp](https://gitea.arcodange.lab/arcodange-org/erp/issues) | **P1:** #38 fleet scaffold+AGENTS.md (D8, **entry issue**) · #39 golden set+injection fixtures · #40 invoice-extract atom · #41 provenance checker · #42 compliance linter · #43 GED attach op · #44 idempotency keys · #45 POC-5 routing bench (D5) · #47 POC-1 exit gate (umbrella) — **P2:** #46 POC-6 Qonto-as-PA (D4; step 1 = [HUMAN] Qonto UI) — **P3:** #48 T13 drift watchdog · #59 T14 backup freshness+drill · #49 T17 second-brain hooks (D7; meeting lane D9 parked) · #50 POC-2 Pi sentinel (D6) — **Compliance:** #51 Dolibarr verifications (FEC/BlockedLog, startable today) — **P4:** #52 POC-3 reco+payments · #53 T05 client invoice (D3, ⚠️ July manual ~07-23) — **P5:** #54 fiscal profile+calendar files+ADC register · #60 T11 reminder loop · #55 POC-4 TVA dry-runs — **Ops (post-replay):** #56 known-patterns fix · #57 bucket C + document gaps |
| [telegram-gateway](https://gitea.arcodange.lab/arcodange/telegram-gateway/issues) | #1 Postgres durable queue (D1) · #2 daily digest + approval cards | | [telegram-gateway](https://gitea.arcodange.lab/arcodange/telegram-gateway/issues) | #1 Postgres durable queue (D1) · #2 daily digest + approval cards |
| [factory](https://gitea.arcodange.lab/arcodange-org/factory/issues) | #22 ADRs as decisions close (D1/D2/D4/D6/D7) | | [factory](https://gitea.arcodange.lab/arcodange-org/factory/issues) | #22 ADRs as decisions close (D1/D2/D4/D6/D7) |
+31 -1
View File
@@ -22,6 +22,8 @@ Arcodange self-hosts Dolibarr, so it is not just a software *user* — it is the
| **Sequential numbering** of invoices | CGI art. 289 | Dolibarr owns the sequence (numbering masks); the linter rejects any manifest supplying a manual ref where Dolibarr must assign it; [T05](task-inventory.md#t05--client-invoice-issuance) guardrail. | | **Sequential numbering** of invoices | CGI art. 289 | Dolibarr owns the sequence (numbering masks); the linter rejects any manifest supplying a manual ref where Dolibarr must assign it; [T05](task-inventory.md#t05--client-invoice-issuance) guardrail. |
| **Retention** — 10 years commercial, 6 years fiscal | L.123-22 / LPF L.102 B | Daily backups with 10-year tiered retention, restore-tested ([T14](task-inventory.md#t14--backup--restore-verification)); GED attachment presence audited monthly. | | **Retention** — 10 years commercial, 6 years fiscal | L.123-22 / LPF L.102 B | Daily backups with 10-year tiered retention, restore-tested ([T14](task-inventory.md#t14--backup--restore-verification)); GED attachment presence audited monthly. |
| **Copie fiable** for digitized paper originals | LPF A.102 B-2, arrêté 2017-03-22 | Mostly moot: sources are native PDFs/e-invoices. Any paper original is *kept* — the fleet never destroys paper; a copie-fiable process (PDF/A + fingerprint + timestamp) is deferred until paper volume justifies it. | | **Copie fiable** for digitized paper originals | LPF A.102 B-2, arrêté 2017-03-22 | Mostly moot: sources are native PDFs/e-invoices. Any paper original is *kept* — the fleet never destroys paper; a copie-fiable process (PDF/A + fingerprint + timestamp) is deferred until paper volume justifies it. |
| **Permanence des méthodes** — rules and procedures applied consistently across exercices; departures justified | PCG art. 121-5 | The [ADC register](#accounting-decision-records-adc): every method choice is a record, immutable once Accepted — changes supersede with an impact note, never edit; `fiscal.yaml` rules cite their ADC; the annexe's « règles et méthodes » section is generated from the register. |
| **Accounting-organisation documentation** — a description of procedures and organisation sufficient to understand and control the processing system | PCG art. 911-3 | The agent-facing doc surface *is* it: AGENTS.md + SKILL.md + the atom registry + the ADC register + run journals — versioned in git, kept as long as the accounts they explain. |
| **Certified cash-register software** (inaltérabilité/sécurisation/conservation/archivage attested NF525 or editor certificate) | CGI art. 286-I-3° bis | **Not applicable today**: it binds *systèmes de caisse* (B2C payment recording); Arcodange is B2B-only. Dolibarr's **BlockedLog** module (chained, hash-linked event register — Dolibarr's answer to this law) is the cheap belt-and-braces anyway: evaluated on the sandbox first because enabling it is designed to be hard to undo. Re-scoped the day any B2C receipt appears. | | **Certified cash-register software** (inaltérabilité/sécurisation/conservation/archivage attested NF525 or editor certificate) | CGI art. 286-I-3° bis | **Not applicable today**: it binds *systèmes de caisse* (B2C payment recording); Arcodange is B2B-only. Dolibarr's **BlockedLog** module (chained, hash-linked event register — Dolibarr's answer to this law) is the cheap belt-and-braces anyway: evaluated on the sandbox first because enabling it is designed to be hard to undo. Re-scoped the day any B2C receipt appears. |
## The ledger grammar (production) ## The ledger grammar (production)
@@ -40,6 +42,33 @@ Forbidden regardless of who asks: editing or deleting a validated document, renu
The sandbox is deliberately **exempt**: rehearsals may create, mangle and wipe anything — its state is refreshed iso-prod on demand and never *is* the books. Exemption stops at the boundary: a manifest is linted against the production grammar **before** rehearsal, so the sandbox rehearses only what production would accept. The sandbox is deliberately **exempt**: rehearsals may create, mangle and wipe anything — its state is refreshed iso-prod on demand and never *is* the books. Exemption stops at the boundary: a manifest is linted against the production grammar **before** rehearsal, so the sandbox rehearses only what production would accept.
## Accounting decision records (ADC)
Software records its architectural choices in ADRs; accounting has the same need — **consistency you can justify** — but scatters it across instruments: the **permanence des méthodes** principle (PCG art. 121-5 — methods apply identically from one exercice to the next; departing requires justification), the **annexe** of the annual accounts (where règles et méthodes and any change of method are disclosed), the **organisation documentation** (PCG art. 911-3), and — in audit practice — the *accounting position memo* (one memo per significant judgment, kept for the auditor). None of these give a TPE a lightweight, versioned, per-decision artifact. The **ADC** (*décision comptable*) is that artifact: the house MADR-lite ADR discipline ([factory#22](https://gitea.arcodange.lab/arcodange-org/factory/issues/22)) plus the fields accounting demands.
**Home:** `fleet/profile/decisions/adc-NNN-<slug>.md` in the erp repo — next to `fiscal.yaml`, which the records justify (both are [erp#54](https://gitea.arcodange.lab/arcodange-org/erp/issues/54) deliverables).
**Format — MADR-lite + accounting fields:** Status (Proposed → Accepted → Superseded-by-NNN) · decided date + **`effective_from`/`effective_until`** (aligned with `fiscal.yaml` rules) · Context (the *fait générateur* — the transaction that forced a choice) · Decision · **Base légale & doctrine** (PCG / CGI / BOFiP / expert-comptable advice — the field tech ADRs don't need) · Alternatives rejected, with why · Consequences (accounts touched, annexe impact, downstream rules) · QA & validation (sandbox rehearsal, €-parity, expert review) · References (example écritures, issues).
**Four rules make it comptable:**
1. **Immutable once Accepted — supersede, never edit.** Permanence des méthodes made structural: a method change is a new ADC with an explicit impact note and an effective date (ideally an exercice boundary), never a silent drift.
2. **Every `fiscal.yaml` rule cites its ADC** (`decision: adc-NNN`). The machine-readable rule is the *what*; the ADC is the *why*. Run journals already cite the rule they applied, so the chain **écriture → règle → ADC → base légale** answers a vérificateur's « justifiez ce traitement » in four hops, identically every time ([challenges C6](challenges.md)).
3. **The annexe writes itself at close:** the « règles et méthodes » section is generated from the ADCs Accepted and in force during the exercice, plus any change of method with its impact note.
4. **Proposed ADCs are the expert-comptable agenda.** The periodic checkpoint reviews them; **acceptance is a human act**, journaled — an agent may draft an ADC (with sources), never Accept one.
**Seed register** — real decisions already made (to formalize) or pending (Proposed); first content of `fleet/profile/decisions/`:
| id | Decision | Status |
| --- | --- | --- |
| adc-001 | KM invoices under autoliquidation art. 259-1° CGI — no French VAT, CA3 box E2, invoice mention | to write — Accepted in practice since the first invoice |
| adc-002 | FX deltas on customer wires → 766/666 produits/charges financiers (payment recorded at invoice remaining; delta booked separately) | to write — applied in the 2026-07-11 regularization |
| adc-003 | AI/SaaS subscriptions expensed (6xx), never immobilized at current unit costs | to write — implicit today |
| adc-004 | Stay réel simplifié until the legal abolition; quarterly CA3 from 2027-01-01, no early opt-out | to write — Accepted in practice |
| adc-005 | Personal-card business expenses through the compte courant d'associé (455 lane) | to write — practiced; formalized with [erp#57](https://gitea.arcodange.lab/arcodange-org/erp/issues/57) |
| adc-006 | KM retainer currency & composition (USD multicurrency vs EUR-at-settlement; line structure) | **Proposed — blocks [erp#53](https://gitea.arcodange.lab/arcodange-org/erp/issues/53) wiring; operator input needed** |
| adc-007 | Capital-deposit entry path (1013; module compta vs paiement divers) | Proposed — awaits [erp#51](https://gitea.arcodange.lab/arcodange-org/erp/issues/51) findings |
## Dolibarr verifications (sandbox first) ## Dolibarr verifications (sandbox first)
Each of these runs on a fresh iso-prod checkpoint before any prod change; results land in [STATUS](STATUS.md): Each of these runs on a fresh iso-prod checkpoint before any prod change; results land in [STATUS](STATUS.md):
@@ -54,4 +83,5 @@ Each of these runs on a fresh iso-prod checkpoint before any prod change; result
- FEC expectations for the first exercice (mid-January 2026 incorporation, close 2026-12-31) given the accounting-module timeline; - FEC expectations for the first exercice (mid-January 2026 incorporation, close 2026-12-31) given the accounting-module timeline;
- whether adopting BlockedLog pre-emptively has any downside for a B2B-only SAS; - whether adopting BlockedLog pre-emptively has any downside for a B2B-only SAS;
- confirmation that the PAF-by-architecture approach (journals + tx-id reconciliation + monthly packs) satisfies art. 289 VII documentation expectations for the export invoices. - confirmation that the PAF-by-architecture approach (journals + tx-id reconciliation + monthly packs) satisfies art. 289 VII documentation expectations for the export invoices;
- review of the seed [ADC register](#accounting-decision-records-adc): confirm adc-001…005 as written, arbitrate the two Proposed (adc-006 retainer currency/composition, adc-007 capital-entry path), and confirm the generated-annexe approach is acceptable for the first exercice.