Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ New entries append chronologically and are never renumbered — a gap in the tag

## Files That Change Together

- `H1-H8.md` expected numbers ↔ engine version ↔ `npm test` test counts ↔ validator check count (currently 2.1.2 ↔ 16 ↔ 2495 ↔ 649 - the npm test number tracks the latest measured count; every literal here is a measured number, so a green run that disagrees means the number below is stale, not that the run is wrong).
- `H1-H8.md` expected numbers ↔ engine version ↔ `npm test` test counts ↔ validator check count (currently 2.1.2 ↔ 16 ↔ 2502 ↔ 649 - the npm test number tracks the latest measured count; every literal here is a measured number, so a green run that disagrees means the number below is stale, not that the run is wrong).
- `freeze-record-4.2.6.json` ↔ any file it pins ↔ `.gitattributes` tree list ↔ README pin-count claim (now 49 = 30+19; README.md's own pin is inside the record it links from). Take the split from the record itself, never from a remembered literal — the "47 = 28+19" figure that stood here for several cycles was two pins stale, and `test/verifier-c/validate-freeze.test.mjs` had the same class of rot frozen into its own header comment (it advertised `46/46` while the record held 49; the assertions were already deriving the number, only the documentation lied). The dashboard's `#payout` section is bilingual per the AGENTS.md i18n pattern: its `test/p2/governance-dashboard-i18n.test.js` contract keeps the EN markup defaults and the AR dictionary structurally paired — edit one side only and the pairing check fails by name.
- Bilingual dashboard pair ↔ AGENTS.md i18n pattern above ↔ the EN mirror (`coreguard-gate41-visual-en.html`) — regenerate the dictionary by structural pairing after ANY structural edit to either file. **Correction to an invariant that does not exist: the "637/637 node pairing" cited here for several cycles is dead** — no file, test, or script derives or checks 637. What is genuinely enforced is narrower and real, in two places. **(1) `docs/GOVERNANCE-DASHBOARD.html`** — `test/p2/governance-dashboard-i18n.test.js` binds the `PAYOUT_GATE_I18N` dictionary to that section's `data-i18n` markup (**11 keys**: every key present exactly once, no unused keys, EN/AR inline-tag sequences equal, tags balanced, AR values carrying Arabic). **(2) `docs/coreguard-gate41-visual.html`** — `test/p2/gate41-visual-i18n.test.js` pins that page's one runtime dictionary `D = {"nodes": {"<id>": {ar, en}}, "attrs": …}` as a **bijection** against the markup: **277 static `data-i18n` keys ↔ 277 entries**, 0 missing, 0 orphan, every entry carrying a non-empty `ar` and `en`, no `.en` leaking Arabic, and `apply()` itself asserted to still iterate `D.nodes` and select by the iterated key (data can be perfect while the switcher no longer reads it — the [C27] two-channel trap). Two measured facts that look like defects and are **not**: entries 84/93/104 have an `.ar` with no Arabic because they are the bare RTL arrows `←`/`→`, and **29** entries embed a *nested* `data-i18n` inside their own `.ar` value (the outer entry replaces `innerHTML`, so the inner attribute is redundant and order-dependent, yet every inner key also appears in static markup so nothing is orphaned and the page renders correctly) — the count is **pinned, not asserted zero**, because changing it is a deliberate edit to a live investor-facing page. **(3) the EN sister `coreguard-gate41-visual-en.html` itself** — this was the last unguarded piece, and `test/p2/gate41-visual-en-parity.test.js` now closes it. The invariant is **NOT** "the two files are identical" — measured, they are not, and asserting it would be another dead number like 637. The AR page is the *interactive* twin (language switcher); the sister is the *printable* twin (printhead + print button), which is exactly why [C5]'s dictionary walk dropped the EN `printhead` subtree first. So the contract pins (a) **all 277 dictionary `.en` values appear verbatim in the sister** — the cross-file link, 0 absent; (b) **load-bearing element counts are identical** (section 10 · h1 1 · h2 10 · h3 12 · h4 5 · table 4 · thead/tbody 4 · tr 30 · ul 5 · li 10 · a 14 · p 19 · button 3 · ids 34) — a row or heading that exists in one twin only means the sister is a stale snapshot, invisible to any per-file test; (c) the **only** permitted tag differences are `b`/`span`/`div` each **+1** in the sister, pinned as a set and re-checked against the presence of the `printhead` that causes them, so a new divergence cannot hide beside a sanctioned one; (d) the sister **stays dictionary-free** (0 `data-i18n`, 0 `D.nodes`, 0 `L(`) — it is literal English, and a second dictionary would be a second source of truth ([C27]); (e) the sister leaks **no Arabic** in any of its 539 text runs; (f) `lang="ar" dir="rtl"` vs `lang="en" dir="ltr"` — the one attribute pair that *should* differ, and wrong `dir` reverses the whole board's order while every text assertion still passes; (g) the role asymmetry is pinned as fact, so nobody "fixes" it and nobody lets it rot. One consequence worth knowing: **221 of the 277 `.ar` values are already literal Arabic in the static markup**, so the AR page renders with JS disabled — the dictionary is the *switcher's payload*, not its only source of text, and that count is pinned so stripping the literal text (a silent availability regression every dictionary assertion would pass) cannot land unnoticed. 12 negative controls, and the battery reports **coverage, not just a count**: all 8 tests were observed failing (the extractor needs `--test-reporter=tap`, because the default reporter prints glyphs and an ASCII `not ok` filter finds nothing).
- `verification/cg-assurance-verify.ps1` self-test count (21) ↔ `selftest.tap` frozen bytes ↔ README/STATUS claims (21/21).
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Then: **[Developer quickstart](docs/DEVELOPER-QUICKSTART.md)** (three calls) ·
| Independent Verifier | SHIPPED | JS / Rust-WASM / Python verifiers. Trust never depends on us running a hosted check. | مُحققات JS و Rust-WASM و Python. الثقة مش معتمدة إننا نشغّل فحص عندنا. |
| Badge Shield | SHIPPED | Embeddable verification badges rendered only from anchored manifests. | شارات تحقق تتحط في أي موقع، بتطلع بس من بيانات متثبّتة على السلسلة. |
| ★ PSAR/1 Pre-Sign Authorization Receipts | SHIPPED | A Stellar transaction carries its own authorization proof before any signature — PASS / BLOCK, bound to the exact XDR bytes. 37 tests; v1 does not semantically decode XDR. | معاملة Stellar بتشيل إثبات التصريح بتاعها قبل أي توقيع — PASS أو BLOCK، مربوطة بنفس بايتات المعاملة بالظبط. 37 اختبار؛ والإصدار الأول مش بيفك محتوى XDR دلاليًا. |
| ★ Agent Commerce Security — AC-FW/1 · CGCR/1 · AGR/1 | SHIPPED | Agent authorization firewall, verifiable consent receipts and risk engine — SDK, MCP server and REST API. 2495/2495 tests, offline and fail-closed. | جدار تفويض للوكلاء، وإيصالات موافقة قابلة للتحقق، ومحرك مخاطر — SDK وخادم MCP وREST API. ‏2453/2453 اختبار، دون اتصال ورفض آمن. |
| ★ Agent Commerce Security — AC-FW/1 · CGCR/1 · AGR/1 | SHIPPED | Agent authorization firewall, verifiable consent receipts and risk engine — SDK, MCP server and REST API. 2502/2502 tests, offline and fail-closed. | جدار تفويض للوكلاء، وإيصالات موافقة قابلة للتحقق، ومحرك مخاطر — SDK وخادم MCP وREST API. ‏2453/2453 اختبار، دون اتصال ورفض آمن. |
| CGXA/1 + CGXA-SOROBAN/1 — Execution Attestation | DRY_RUN | Offline attestation of the approval↔execution arc with Soroban consent-binding preparation. No broadcast; on-chain action is owner-gated. | شهادة دون اتصال لمسار الموافقة↔التنفيذ مع تجهيز ربط الموافقة على Soroban. بدون بث؛ التنفيذ على السلسلة بقرار المالك. |
| Trust Gate · Labs · Verify Bot | RESEARCH | Investor portal (TRUST.md) live; CoreGuard Labs evidence lab DRAFT; Telegram/Discord verify bot PLAN_ONLY. | بوابة المستثمر (TRUST.md) شغالة؛ معمل الأدلة CoreGuard Labs مسودة؛ بوت التحقق لسه خطة. |
| @coreguard/sdk + CLI | GATED | Two-line SDK integration and `npx coreguard demo`. 13-package npm closure, release-gated. | دمج في سطرين و`npx coreguard demo`. 13 حزمة npm بانتظار بوابة الإصدار. |
Expand Down Expand Up @@ -378,7 +378,7 @@ Run the offline arc: `npm run stellar:presign` — no signing, no wallet, no net

### Recent developments — Nov 10–14 2026 (by network, measured & evidenced)

> Canonical measured state for this cycle: **2495 / 2495 tests**, **1917 files scanned / 0 violations**, **docs-node 140 executed · 91 skip-listed · 34 covered**, **Foundry 43/43 pass** — [docs/state-snapshot.json](docs/state-snapshot.json) · [docs/STATUS.md](docs/STATUS.md). Every item below is labeled by its committed evidence; nothing implies revenue, customers, partnerships, external adoption, or a third-party audit.
> Canonical measured state for this cycle: **2502 / 2502 tests**, **1928 files scanned / 0 violations**, **docs-node 140 executed · 91 skip-listed · 34 covered**, **Foundry 43/43 pass** — [docs/state-snapshot.json](docs/state-snapshot.json) · [docs/STATUS.md](docs/STATUS.md). Every item below is labeled by its committed evidence; nothing implies revenue, customers, partnerships, external adoption, or a third-party audit.

#### Stellar — pre-sign receipts, agent-gate envelope path, Freighter evaluation, DEX integration

Expand Down Expand Up @@ -755,7 +755,7 @@ CoreGuard answers one question with evidence: **did this execution conform to wh
npm install

# 2. Test + benchmark
npm test # 2495 tests (machine-pinned) — canonicalization, policy, tamper, anchor, verifier, P1/P2, provenance, pricing, encoding, attack-lab, DDE delivery/dispute suites (incl. doc-curl contract), pages-settle guard, verification-platform suite, executed-evidence contract (agent gate · real-book DEX gate · universal shield · first funded signed mainnet swap), the PSAR/1 pre-sign receipt suite (offline PASS/BLOCK demo), owner-authorized deploy battery
npm test # 2502 tests (machine-pinned) — canonicalization, policy, tamper, anchor, verifier, P1/P2, provenance, pricing, encoding, attack-lab, DDE delivery/dispute suites (incl. doc-curl contract), pages-settle guard, verification-platform suite, executed-evidence contract (agent gate · real-book DEX gate · universal shield · first funded signed mainnet swap), the PSAR/1 pre-sign receipt suite (offline PASS/BLOCK demo), owner-authorized deploy battery
git config core.hooksPath .githooks # install the Pages settle pre-push guard — every main push waits for the Pages build
npm run corpus # deterministic 73-scenario adversarial corpus
npm run benchmark # 73/73 pass
Expand Down
20 changes: 20 additions & 0 deletions detectors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CoreGuard Detectors — Eight Product Lines Map

**Status boundary:** All modules in `detectors/` are either **PROTOTYPE** (minimal deterministic logic with unit tests) or **PLANNED** (specification only). No external customer, partner, audit, production deployment, or banking integration is claimed.

| # | Product Line | Detector Status | Location / Scope |
|---|---|---|---|
| 1 | **CoreGuard Verify** | SPEC (`PROTOTYPE`) | [`spec/VER-1.md`](../spec/VER-1.md) — Verifiable Execution Receipt v1 |
| 2 | **CoreGuard Agent** | `PROTOTYPE` | [`detectors/agent-pay/index.js`](./agent-pay/index.js) — per-tx, daily, session limits, allowlist, fail-closed |
| 3 | **CoreGuard CrossBorder** | `PLANNED` | [`detectors/crossborder/SPEC.md`](./crossborder/SPEC.md) — instruction-to-settlement integrity |
| 4 | **CoreGuard RWA** | `PLANNED` | [`detectors/rwa/SPEC.md`](./rwa/SPEC.md) — mint/redeem & reserve-data invariants |
| 5 | **CoreGuard Lending** | `PROTOTYPE` + `PLANNED` | [`detectors/oracle/index.js`](./oracle/index.js) (oracle freshness/quorum/deviation) & [`detectors/lending/SPEC.md`](./lending/SPEC.md) |
| 6 | **CoreGuard Quantum & Identity** | `PROTOTYPE` | [`detectors/pqc-readiness/index.js`](./pqc-readiness/index.js) — lexical crypto inventory (Ed25519, ECDSA, secp256k1, RSA, ML-DSA/Dilithium) |
| 7 | **CoreGuard Chain** | `PLANNED` | [`detectors/chain/SPEC.md`](./chain/SPEC.md) — multi-chain upgrade & replay guards |
| 8 | **CoreGuard Intelligence** | `PLANNED` | [`detectors/intelligence/SPEC.md`](./intelligence/SPEC.md) — claim-vs-proof & anti-scam checks |

## Signal vs Noise

- **Signal (real engineering directions):** Post-quantum signatures & crypto-agility, x402 machine-to-machine payments, tokenized deposits, card tokenization, and selective-disclosure digital identity.
- **Noise (explicitly rejected as unverified):** "Energy Cubes" unified currency claims, unsourced "Quantum Protocol 30" narratives, and "robot war / counter reset" speculation are NOT product capabilities or evidence.
- **Target ecosystems, not integrations:** SWIFT, banks, and lending apps are target markets only. No SWIFT integration is claimed.
39 changes: 39 additions & 0 deletions detectors/agent-pay/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// PROTOTYPE: pure deterministic spending-policy gate for autonomous agents.
// Fail-closed: any missing, malformed, negative, non-integer, or unverified context -> NOT_VERIFIED.
export function detectAgentPay(input = {}) {
const unknown = () => ({
status: "PROTOTYPE",
verdict: "NOT_VERIFIED",
not_verified: ["Missing, invalid, or untrusted spending context"],
reasons: [],
});
if (!input || typeof input !== "object") return unknown();
const {
amount, dailySpent, sessionSpent,
perTransactionLimit, dailyLimit, sessionLimit,
recipient, recipientAllowlist, contextVerified,
} = input;
const values = [amount, dailySpent, sessionSpent, perTransactionLimit, dailyLimit, sessionLimit];
if (
contextVerified !== true ||
!values.every((v) => Number.isSafeInteger(v) && v >= 0) ||
!Number.isSafeInteger(dailySpent + amount) ||
!Number.isSafeInteger(sessionSpent + amount) ||
typeof recipient !== "string" || !recipient.trim() ||
!Array.isArray(recipientAllowlist) ||
!recipientAllowlist.every((v) => typeof v === "string" && v.trim())
) {
return unknown();
}
const reasons = [];
if (amount > perTransactionLimit) reasons.push("PER_TRANSACTION_LIMIT");
if (dailySpent + amount > dailyLimit) reasons.push("DAILY_LIMIT");
if (sessionSpent + amount > sessionLimit) reasons.push("SESSION_LIMIT");
if (!recipientAllowlist.includes(recipient)) reasons.push("RECIPIENT");
return {
status: "PROTOTYPE",
verdict: reasons.length ? "REJECTED" : "VERIFIED",
not_verified: [],
reasons,
};
}
5 changes: 5 additions & 0 deletions detectors/chain/SPEC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CoreGuard Chain Detector — PLANNED

**Status:** PLANNED (specified, not implemented; complements live Stellar Soroban and Core DAO anchors elsewhere in this repository)

Intended scope: protocol upgrade permission guards, signature replay checks across chains, and multi-chain adapter checks for Stellar, Core DAO, Ethereum, and Pi Network.
7 changes: 7 additions & 0 deletions detectors/crossborder/SPEC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CoreGuard CrossBorder Detector — PLANNED

**Status:** PLANNED (specified, not implemented)

Intended scope: payment instruction integrity, duplicate/replay detection, and message-to-settlement reconciliation across banking rails, stablecoins, and tokenized deposits.

**Explicit boundary:** SWIFT and banking institutions are target ecosystems only. No SWIFT integration, bank customer, or production rail connection is claimed.
5 changes: 5 additions & 0 deletions detectors/intelligence/SPEC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CoreGuard Intelligence Detector — PLANNED

**Status:** PLANNED (specified, not implemented)

Intended scope: claim-vs-proof source verification and anti-phishing checks that bind protocol claims to primary references (RFCs, CAPs, official repositories) and reject unsourced social rumors.
5 changes: 5 additions & 0 deletions detectors/lending/SPEC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CoreGuard Lending Detector — PLANNED

**Status:** PLANNED (specified, not implemented)

Intended scope: loan decision-to-disbursement integrity, repayment ledger reconciliation, and collateral/liquidation safety checks (building on the `detectors/oracle` prototype). Does not make credit decisions or replace AML/KYC systems.
41 changes: 41 additions & 0 deletions detectors/oracle/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// PROTOTYPE: deterministic price-oracle freshness, quorum, and deviation gate.
// Fail-closed: missing, duplicate, non-positive, future-dated, or unverified observations -> NOT_VERIFIED.
export function detectOracle(input = {}) {
const unknown = () => ({
status: "PROTOTYPE",
verdict: "NOT_VERIFIED",
not_verified: ["Missing, invalid, or untrusted oracle context"],
reasons: [],
});
if (!input || typeof input !== "object") return unknown();
const { sources, nowSec, maxAgeSec, maxDeviationBps, minSources, contextVerified } = input;
if (
contextVerified !== true ||
!Array.isArray(sources) ||
![nowSec, maxAgeSec, maxDeviationBps].every((v) => Number.isSafeInteger(v) && v >= 0) ||
!Number.isSafeInteger(minSources) || minSources < 1 ||
!sources.every((s) =>
s && typeof s.id === "string" && s.id.trim() &&
Number.isSafeInteger(s.price) && s.price > 0 &&
Number.isSafeInteger(s.timestampSec) && s.timestampSec >= 0 && s.timestampSec <= nowSec
) ||
new Set(sources.map((s) => s.id)).size !== sources.length
) {
return unknown();
}
const reasons = [];
if (sources.length < minSources) reasons.push("INSUFFICIENT_SOURCES");
if (sources.some((s) => nowSec - s.timestampSec > maxAgeSec)) reasons.push("STALE_PRICE");
if (sources.length) {
const prices = sources.map((s) => BigInt(s.price));
const low = prices.reduce((a, b) => (a < b ? a : b));
const high = prices.reduce((a, b) => (a > b ? a : b));
if ((high - low) * 10000n > BigInt(maxDeviationBps) * low) reasons.push("PRICE_DEVIATION");
}
return {
status: "PROTOTYPE",
verdict: reasons.length ? "REJECTED" : "VERIFIED",
not_verified: [],
reasons,
};
}
32 changes: 32 additions & 0 deletions detectors/pqc-readiness/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// PROTOTYPE: lexical cryptographic algorithm inventory for PQC readiness planning.
// Never claims post-quantum readiness or security certification.
const PATTERNS = [
["Ed25519", /\bed25519\b/gi],
["ECDSA", /\becdsa\b/gi],
["secp256k1", /\bsecp256k1\b/gi],
["RSA", /\brsa(?:[-_]?(?:1024|2048|3072|4096))?\b/gi],
["ML-DSA/Dilithium", /\b(?:ml[-_]?dsa(?:[-_]?(?:44|65|87))?|dilithium[235]?)\b/gi],
];

export function scanPqcReadiness(source) {
if (typeof source !== "string") {
return {
status: "PROTOTYPE",
verdict: "NOT_VERIFIED",
inventory: [],
not_verified: ["Source text unavailable"],
};
}
const inventory = PATTERNS.flatMap(([algorithm, re]) => {
const count = [...source.matchAll(re)].length;
return count ? [{ algorithm, count }] : [];
});
return {
status: "PROTOTYPE",
verdict: "NOT_VERIFIED",
inventory,
not_verified: ["Runtime usage and cryptographic security not established by lexical scan"],
crypto_agility_note:
"Classical signatures (Ed25519, ECDSA, secp256k1, RSA) are not post-quantum secure. Isolate signing interfaces, inventory keys and dependencies, and plan a validated migration. ML-DSA/Dilithium mentions do not prove readiness.",
};
}
5 changes: 5 additions & 0 deletions detectors/rwa/SPEC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CoreGuard RWA Detector — PLANNED

**Status:** PLANNED (specified, not implemented)

Intended scope: mint/redeem invariant checks, supply-cap enforcement, reserve-data integrity checks (distinguished from independent physical reserve audits), and cross-chain supply consistency.
Loading
Loading