Files
2nd/10_Wiki/Topics/Domain_Programming/AI_and_ML/Reconciliation.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

5.9 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-reconciliation Reconciliation 10_Wiki/Topics verified self
Data Reconciliation
Conflict Resolution
CRDT
none A 0.9 applied
reconciliation
crdt
distributed
finance
sync
2026-05-10 pending
language framework
typescript yjs

Reconciliation

매 한 줄

"매 두 source 의 truth 의 align". Reconciliation 의 financial (ledger ↔ bank statement match), data (master ↔ replica), distributed (CRDT conflict-free merge), AI (multi-agent state sync) 의 cross-domain pattern. 2026 의 local-first software 의 CRDT renaissance.

매 핵심

매 Financial reconciliation

  • 3-way match: PO ↔ receipt ↔ invoice.
  • Bank rec: GL ↔ bank statement 의 daily.
  • Sub-ledger to GL: AR/AP detail 의 control account match.
  • 2026 tools: BlackLine, FloQast, AI-driven (Trullion).

매 Data reconciliation

  • CDC (Change Data Capture): Debezium, source-of-truth log.
  • Lambda architecture: batch + stream — 매 reconcile 의 daily.
  • Idempotency: 매 retry 의 safe — UUID dedup.
  • Checksum: row-count + hash 의 source vs target.

매 CRDT (Conflict-free Replicated Data Type)

  • G-Counter: grow-only counter (sum across replicas).
  • PN-Counter: increment + decrement.
  • OR-Set: observed-remove set — add wins.
  • LWW-Register: last-write-wins by timestamp.
  • RGA / Yjs Y.Text: collaborative text.
  • Automerge: JSON CRDT, local-first.

매 Modern distributed

  • Operational Transform (OT): Google Docs 의 legacy. Server-coord.
  • CRDT: Notion, Linear, Figma (mixed). P2P-friendly.
  • Vector clocks: causal ordering.
  • Hybrid Logical Clock (HLC): physical + logical — CockroachDB.

매 응용

  1. Collaborative editing (Yjs, Automerge).
  2. Offline-first mobile app sync.
  3. Multi-region database (DynamoDB Global, Cosmos DB).
  4. Bank ledger reconciliation.
  5. Multi-agent LLM shared scratchpad.

💻 패턴

Yjs collaborative text (TypeScript)

import * as Y from "yjs";
import { WebsocketProvider } from "y-websocket";

const doc = new Y.Doc();
const provider = new WebsocketProvider("wss://sync.example.com",
                                        "room-1", doc);
const text = doc.getText("content");

text.observe(event => console.log("delta:", event.delta));
text.insert(0, "Hello ");
// 매 다른 client 의 concurrent insert 의 auto-merge

Automerge JSON CRDT

import * as Automerge from "@automerge/automerge";

let doc1 = Automerge.from({ tasks: [] as string[] });
let doc2 = Automerge.clone(doc1);

doc1 = Automerge.change(doc1, d => d.tasks.push("write spec"));
doc2 = Automerge.change(doc2, d => d.tasks.push("review code"));

const merged = Automerge.merge(doc1, doc2);
// merged.tasks == ["write spec", "review code"] — 매 conflict X

G-Counter (CRDT)

class GCounter:
    def __init__(self, node_id: str):
        self.node = node_id
        self.counts: dict[str, int] = {}
    def inc(self, n: int = 1):
        self.counts[self.node] = self.counts.get(self.node, 0) + n
    def value(self) -> int:
        return sum(self.counts.values())
    def merge(self, other: "GCounter"):
        for k, v in other.counts.items():
            self.counts[k] = max(self.counts.get(k, 0), v)

Bank reconciliation pseudo

def reconcile(gl: list[Txn], bank: list[Txn]) -> dict:
    matched, gl_only, bank_only = [], [], []
    bank_idx = {(t.amount, t.date): t for t in bank}
    for g in gl:
        key = (g.amount, g.date)
        if key in bank_idx:
            matched.append((g, bank_idx.pop(key)))
        else:
            gl_only.append(g)
    bank_only = list(bank_idx.values())
    return {"matched": matched, "gl_only": gl_only, "bank_only": bank_only}

Idempotent upsert (Postgres)

INSERT INTO orders (id, amount, status)
VALUES ($1, $2, $3)
ON CONFLICT (id) DO UPDATE SET
  amount = EXCLUDED.amount,
  status = EXCLUDED.status,
  updated_at = NOW();

CDC with Debezium (Kafka Connect)

{
  "name": "pg-source",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "database.hostname": "db", "database.dbname": "app",
    "plugin.name": "pgoutput",
    "topic.prefix": "app",
    "table.include.list": "public.orders,public.payments"
  }
}

매 결정 기준

상황 Approach
Real-time collab text Yjs (mature, fast)
Offline-first app Automerge (rich JSON)
Counter across regions PN-Counter / G-Counter
Centralized server OK OT (simpler) or CRDT
Bank/finance Manual + AI-assist (BlackLine)
DB replica sync CDC (Debezium) + idempotency

기본값: Yjs 의 collab text, Automerge 의 structured offline-first, CDC 의 enterprise data sync.

🔗 Graph

🤖 LLM 활용

언제: 매 reconciliation rule 의 fuzzy match (description, amount tolerance), exception explanation, audit trail summary. 언제 X: deterministic match (use SQL JOIN), regulated final attestation (human sign-off).

안티패턴

  • OT 의 P2P 의 force: 매 OT 의 server 의 require — P2P 의 CRDT 의 use.
  • LWW 의 collab text: 매 char-level loss — RGA / Yjs 의 use.
  • No vector clock 의 causal: 매 wall-clock skew → wrong order.
  • No idempotency key: retry 의 duplicate → double charge.
  • Reconcile manually 매 day: automate w/ exception queue.

🧪 검증 / 중복

  • Verified (Yjs docs, Automerge paper, Shapiro CRDT survey 2011, Debezium docs).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — finance + CRDT + data sync unified