@mudraforge/statutory 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +105 -124
- package/SKILL.md +7 -2
- package/bin/cli.js +215 -8
- package/docs/ARCHITECTURE.md +8 -8
- package/docs/ARCHITECTURE_DECISIONS.md +4 -3
- package/docs/CATALOG.md +1 -1
- package/docs/CORPUS_QUALITY.md +5 -5
- package/docs/DOMAIN_BREADTH_AND_DEPTH_COMPARISON.md +1 -1
- package/docs/ENTERPRISE_GOVERNANCE.md +81 -22
- package/docs/PILOT_EVALUATION_GUIDE.md +155 -90
- package/docs/PROVENANCE.md +4 -4
- package/docs/VERIFICATION.md +7 -7
- package/okf/manifest.json +1 -1
- package/package.json +18 -1
- package/src/constants.js +10 -0
- package/src/index.js +92 -13
- package/src/outcomes.js +483 -0
- package/types/index.d.ts +55 -0
package/bin/cli.js
CHANGED
|
@@ -22,6 +22,9 @@ import {
|
|
|
22
22
|
runStatutoryDoctor,
|
|
23
23
|
crosswalkStatute,
|
|
24
24
|
getStatutoryDiff,
|
|
25
|
+
getStatutoryOutcomes,
|
|
26
|
+
explainStatutoryDisposition,
|
|
27
|
+
ignorePackageUpdate,
|
|
25
28
|
STATUTORY_EXIT_CODES,
|
|
26
29
|
STATUTORY_CLIENT_VERSION,
|
|
27
30
|
DEFAULT_LOCAL_OKF_DIR
|
|
@@ -33,7 +36,14 @@ const __dirname = path.dirname(__filename);
|
|
|
33
36
|
const rawArgs = process.argv.slice(2);
|
|
34
37
|
const isJsonMode = rawArgs.includes('--json') || rawArgs.includes('-j');
|
|
35
38
|
const isOfflineMode = rawArgs.includes('--offline') || rawArgs.includes('-o');
|
|
36
|
-
const
|
|
39
|
+
const isVerboseMode = rawArgs.includes('--verbose') || rawArgs.includes('-v');
|
|
40
|
+
const isNoUpdateCheck = rawArgs.includes('--no-update-check') || rawArgs.includes('--ignore-update');
|
|
41
|
+
const args = rawArgs.filter(a =>
|
|
42
|
+
a !== '--json' && a !== '-j' &&
|
|
43
|
+
a !== '--offline' && a !== '-o' &&
|
|
44
|
+
a !== '--verbose' && a !== '-v' &&
|
|
45
|
+
a !== '--no-update-check' && a !== '--ignore-update'
|
|
46
|
+
);
|
|
37
47
|
const command = args[0] ? args[0].toLowerCase() : 'help';
|
|
38
48
|
|
|
39
49
|
function getNamedArg(nameList, argList) {
|
|
@@ -89,6 +99,26 @@ async function main() {
|
|
|
89
99
|
break;
|
|
90
100
|
}
|
|
91
101
|
|
|
102
|
+
case 'outcomes':
|
|
103
|
+
case 'dispositions':
|
|
104
|
+
case 'states': {
|
|
105
|
+
const section = (args[1] && !args[1].startsWith('-')) ? args[1] : getNamedArg(['--provision', '-p', '--section', '-s'], rawArgs);
|
|
106
|
+
await handleOutcomes(section, { offline: isOfflineMode, verbose: isVerboseMode });
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
case 'explain':
|
|
111
|
+
case 'why':
|
|
112
|
+
case 'remedy': {
|
|
113
|
+
const query = (args[1] && !args[1].startsWith('-')) ? args[1] : getNamedArg(['--code', '-c', '--query', '-q'], rawArgs);
|
|
114
|
+
if (!query) {
|
|
115
|
+
console.error('[ERROR] Please specify a disposition code or status to explain, e.g. npx @mudraforge/statutory explain BUYER_TURNOVER_UNVERIFIED');
|
|
116
|
+
process.exit(STATUTORY_EXIT_CODES.USAGE_ERROR);
|
|
117
|
+
}
|
|
118
|
+
await handleExplain(query);
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
|
|
92
122
|
case 'init-skill':
|
|
93
123
|
case 'install-skill':
|
|
94
124
|
await handleInitSkill(args[1]);
|
|
@@ -96,9 +126,11 @@ async function main() {
|
|
|
96
126
|
|
|
97
127
|
case 'check-update':
|
|
98
128
|
case 'status':
|
|
99
|
-
case 'version':
|
|
100
|
-
|
|
129
|
+
case 'version': {
|
|
130
|
+
const shouldIgnore = rawArgs.includes('--ignore') || args[1] === '--ignore' || args[1] === 'ignore';
|
|
131
|
+
await handleCheckUpdate({ ignore: shouldIgnore });
|
|
101
132
|
break;
|
|
133
|
+
}
|
|
102
134
|
|
|
103
135
|
case 'sync':
|
|
104
136
|
case 'pull':
|
|
@@ -149,13 +181,14 @@ async function main() {
|
|
|
149
181
|
}
|
|
150
182
|
|
|
151
183
|
// Non-intrusive background npm package update notice
|
|
152
|
-
if (!isJsonMode && !
|
|
184
|
+
if (!isJsonMode && !isNoUpdateCheck && command !== 'check-update' && command !== 'status' && command !== 'version') {
|
|
153
185
|
try {
|
|
154
186
|
const updateInfo = await checkForPackageUpdate();
|
|
155
187
|
if (updateInfo && updateInfo.updateAvailable) {
|
|
156
188
|
console.log('───────────────────────────────────────────────────────────────────────────');
|
|
157
189
|
console.log(`[NOTICE] A new version of @mudraforge/statutory is available: ${updateInfo.currentVersion} -> ${updateInfo.latestVersion}`);
|
|
158
190
|
console.log(`Run: npm install @mudraforge/statutory@latest or npx @mudraforge/statutory@latest`);
|
|
191
|
+
console.log(`To dismiss: npx @mudraforge/statutory check-update --ignore`);
|
|
159
192
|
console.log('───────────────────────────────────────────────────────────────────────────\n');
|
|
160
193
|
}
|
|
161
194
|
} catch (_) {}
|
|
@@ -384,14 +417,182 @@ async function handleDiff(options) {
|
|
|
384
417
|
}
|
|
385
418
|
}
|
|
386
419
|
|
|
387
|
-
async function
|
|
420
|
+
async function handleOutcomes(provision, options = {}) {
|
|
421
|
+
try {
|
|
422
|
+
const result = await getStatutoryOutcomes(provision, options);
|
|
423
|
+
if (isJsonMode) {
|
|
424
|
+
console.log(JSON.stringify(result, null, 2));
|
|
425
|
+
process.exit(0);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
console.log('\n===========================================================================');
|
|
429
|
+
console.log('MUDRAFORGE STATUTORY OUTCOMES & SEMANTIC DISPOSITION DICTIONARY');
|
|
430
|
+
console.log('===========================================================================');
|
|
431
|
+
console.log(`Source: ${result.source} ${result.offlineFallback ? '(Offline Fallback)' : ''}`);
|
|
432
|
+
console.log(`Version: v${result.version}`);
|
|
433
|
+
console.log(`Provision Filter: ${result.provision || 'ALL (Global Catalog)'}`);
|
|
434
|
+
console.log(`Total Outcomes: ${result.totalOutcomes}`);
|
|
435
|
+
console.log('===========================================================================');
|
|
436
|
+
|
|
437
|
+
if (result.outcomes.length === 0) {
|
|
438
|
+
console.log(`\nNo specific outcome codes mapped for provision "${result.provision}".`);
|
|
439
|
+
console.log('Showing all global disposition outcomes: run npx @mudraforge/statutory outcomes\n');
|
|
440
|
+
} else {
|
|
441
|
+
result.outcomes.forEach((o, idx) => {
|
|
442
|
+
console.log(`\n── Outcome #${idx + 1}: [${o.code}] ──`);
|
|
443
|
+
console.log(`Title: ${o.title}`);
|
|
444
|
+
console.log(`Category: ${o.category}`);
|
|
445
|
+
console.log(`Description: ${o.description}`);
|
|
446
|
+
console.log(`Trigger Condition: ${o.triggerCondition}`);
|
|
447
|
+
console.log(`Recommended Action: ${o.recommendedAction}`);
|
|
448
|
+
if (options.verbose && o.remedy) {
|
|
449
|
+
console.log(`Resolution Steps: ${o.remedy}`);
|
|
450
|
+
}
|
|
451
|
+
if (o.missingFacts && o.missingFacts.length > 0) {
|
|
452
|
+
console.log(`Missing Facts to Cure: ${o.missingFacts.join(', ')}`);
|
|
453
|
+
if (options.verbose && o.missingFactsExplanation) {
|
|
454
|
+
for (const [key, detail] of Object.entries(o.missingFactsExplanation)) {
|
|
455
|
+
console.log(` ↳ ${key} (${detail.type}): ${detail.description} (Source: ${detail.source})`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (options.verbose && o.consequenceIfUnresolved) {
|
|
460
|
+
console.log(`Consequence on Hold: ${o.consequenceIfUnresolved}`);
|
|
461
|
+
}
|
|
462
|
+
if (o.applicableProvisions && o.applicableProvisions.length > 0) {
|
|
463
|
+
console.log(`Applies to Sections: ${o.applicableProvisions.join(', ')}`);
|
|
464
|
+
}
|
|
465
|
+
console.log(`Governing Law: ${o.governingAuthority}`);
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
console.log('\n───────────────────────────────────────────────────────────────────────────');
|
|
470
|
+
console.log(`[PASS] Statutory outcomes dictionary retrieved successfully (${result.totalOutcomes} outcome(s)) (Exit 0).\n`);
|
|
471
|
+
process.exit(0);
|
|
472
|
+
} catch (err) {
|
|
473
|
+
if (isJsonMode) {
|
|
474
|
+
console.log(JSON.stringify({ status: 'ERROR', exitCode: STATUTORY_EXIT_CODES.USAGE_ERROR, error: err.message }, null, 2));
|
|
475
|
+
} else {
|
|
476
|
+
console.error(`[ERROR] Statutory outcomes lookup failure: ${err.message}`);
|
|
477
|
+
}
|
|
478
|
+
process.exit(STATUTORY_EXIT_CODES.USAGE_ERROR);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
async function handleExplain(query) {
|
|
483
|
+
try {
|
|
484
|
+
const result = explainStatutoryDisposition(query);
|
|
485
|
+
if (isJsonMode) {
|
|
486
|
+
console.log(JSON.stringify(result, null, 2));
|
|
487
|
+
process.exit(0);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
console.log('\n===========================================================================');
|
|
491
|
+
console.log(`MUDRAFORGE STATUTORY EXPLANATION: [${result.query}]`);
|
|
492
|
+
console.log('===========================================================================');
|
|
493
|
+
|
|
494
|
+
if (result.status === 'NOT_FOUND') {
|
|
495
|
+
console.log(`\nNo statutory disposition or indeterminate code found matching "${result.query}".`);
|
|
496
|
+
if (result.availableCodes && result.availableCodes.length > 0) {
|
|
497
|
+
console.log('\nAvailable disposition codes to inspect:');
|
|
498
|
+
result.availableCodes.forEach(c => console.log(` • ${c}`));
|
|
499
|
+
}
|
|
500
|
+
console.log('\nTip: Run "npx @mudraforge/statutory explain INDETERMINATE" to view all hold states.\n');
|
|
501
|
+
process.exit(STATUTORY_EXIT_CODES.USAGE_ERROR);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (result.summary) {
|
|
505
|
+
console.log(`Summary: ${result.summary}`);
|
|
506
|
+
console.log(`Matched Dispositions: ${result.totalMatches}\n`);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
result.matches.forEach((o, idx) => {
|
|
510
|
+
if (result.matches.length > 1) {
|
|
511
|
+
console.log(`\n── [${idx + 1}/${result.matches.length}] Disposition: [${o.code}] ──`);
|
|
512
|
+
} else {
|
|
513
|
+
console.log(`Code: [${o.code}]`);
|
|
514
|
+
}
|
|
515
|
+
console.log(`Title: ${o.title}`);
|
|
516
|
+
console.log(`Category: ${o.category}`);
|
|
517
|
+
console.log(`Governing Law: ${o.governingAuthority}`);
|
|
518
|
+
console.log('\n── What Happened:');
|
|
519
|
+
console.log(` ${o.description}`);
|
|
520
|
+
console.log('\n── Statutory Trigger:');
|
|
521
|
+
console.log(` ${o.triggerCondition}`);
|
|
522
|
+
console.log('\n── How to Resolve in Your Application:');
|
|
523
|
+
console.log(` ${o.remedy || o.recommendedAction}`);
|
|
524
|
+
|
|
525
|
+
if (o.missingFacts && o.missingFacts.length > 0) {
|
|
526
|
+
console.log('\n── Missing Evidence / Parameters to Supply:');
|
|
527
|
+
o.missingFacts.forEach(f => {
|
|
528
|
+
const meta = o.missingFactsExplanation ? o.missingFactsExplanation[f] : null;
|
|
529
|
+
if (meta) {
|
|
530
|
+
console.log(` • ${f} (${meta.type}): ${meta.description}`);
|
|
531
|
+
console.log(` Source: ${meta.source} | Example: ${JSON.stringify(meta.example)}`);
|
|
532
|
+
} else {
|
|
533
|
+
console.log(` • ${f}`);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (o.consequenceIfUnresolved) {
|
|
539
|
+
console.log('\n── Consequence If Unresolved:');
|
|
540
|
+
console.log(` ${o.consequenceIfUnresolved}`);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (o.applicableProvisions && o.applicableProvisions.length > 0) {
|
|
544
|
+
console.log(`\nApplies to Sections: ${o.applicableProvisions.join(', ')}`);
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
console.log('\n───────────────────────────────────────────────────────────────────────────');
|
|
549
|
+
console.log(`[PASS] Statutory explanation completed successfully (Exit 0).\n`);
|
|
550
|
+
process.exit(0);
|
|
551
|
+
} catch (err) {
|
|
552
|
+
if (isJsonMode) {
|
|
553
|
+
console.log(JSON.stringify({ status: 'ERROR', exitCode: STATUTORY_EXIT_CODES.USAGE_ERROR, error: err.message }, null, 2));
|
|
554
|
+
} else {
|
|
555
|
+
console.error(`[ERROR] Statutory explain failure: ${err.message}`);
|
|
556
|
+
}
|
|
557
|
+
process.exit(STATUTORY_EXIT_CODES.USAGE_ERROR);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
async function handleCheckUpdate(options = {}) {
|
|
388
562
|
try {
|
|
389
563
|
let pkgUpdate = null;
|
|
390
564
|
try {
|
|
391
|
-
pkgUpdate = await checkForPackageUpdate({ cacheTtlMs: 0 });
|
|
565
|
+
pkgUpdate = await checkForPackageUpdate({ cacheTtlMs: 0, force: Boolean(options.ignore) });
|
|
392
566
|
} catch (_) {}
|
|
393
567
|
|
|
394
|
-
|
|
568
|
+
if (options.ignore) {
|
|
569
|
+
const versionToIgnore = pkgUpdate?.latestVersion || STATUTORY_CLIENT_VERSION;
|
|
570
|
+
ignorePackageUpdate(versionToIgnore);
|
|
571
|
+
if (isJsonMode) {
|
|
572
|
+
console.log(JSON.stringify({ status: 'SUCCESS', ignoredVersion: versionToIgnore }, null, 2));
|
|
573
|
+
process.exit(0);
|
|
574
|
+
}
|
|
575
|
+
console.log('\n===========================================================================');
|
|
576
|
+
console.log(`[OK] Update notifications will be ignored for version ${versionToIgnore}.`);
|
|
577
|
+
console.log('You will not see update notices until a newer version is published.');
|
|
578
|
+
console.log('===========================================================================\n');
|
|
579
|
+
process.exit(0);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
let status = null;
|
|
583
|
+
try {
|
|
584
|
+
status = await checkUpdates();
|
|
585
|
+
} catch (netErr) {
|
|
586
|
+
if (isJsonMode) {
|
|
587
|
+
console.log(JSON.stringify({ status: 'OFFLINE_FALLBACK', packageUpdate: pkgUpdate, error: netErr.message }, null, 2));
|
|
588
|
+
process.exit(0);
|
|
589
|
+
}
|
|
590
|
+
console.log('───────────────────────────────────────────────────────────────────────────');
|
|
591
|
+
console.log(`Local OKF Version: ${STATUTORY_CLIENT_VERSION}`);
|
|
592
|
+
console.log(`Edge Synchronization: UNAVAILABLE (offline or remote network unreachable)`);
|
|
593
|
+
console.log('───────────────────────────────────────────────────────────────────────────\n');
|
|
594
|
+
process.exit(0);
|
|
595
|
+
}
|
|
395
596
|
|
|
396
597
|
if (isJsonMode) {
|
|
397
598
|
console.log(JSON.stringify({
|
|
@@ -710,10 +911,12 @@ Commands:
|
|
|
710
911
|
verify [path] Cryptographically verify OKF substrate authenticity & file integrity
|
|
711
912
|
crosswalk <section> Dual-act 1961 <-> 2025 bridge (earlier of credit vs payment)
|
|
712
913
|
diff Semantic regulatory changelog (--section, --since, --domain)
|
|
914
|
+
outcomes [provision] Inspect API dispositions, statutory states, trigger conditions & actions
|
|
915
|
+
explain <code/status> In-depth explanation, legal rationale & remediation steps for a disposition
|
|
713
916
|
browse Interactively browse local OKF statutory filesystem
|
|
714
917
|
lookup <section> [date] Look up section details & temporal status (e.g. 194Q 2025-06-01)
|
|
715
918
|
decode-id <pan_or_gstin> Offline ISO Mod-36 checksum, state name, and PAN entity decoding
|
|
716
|
-
check-update
|
|
919
|
+
check-update [--ignore] Check edge updates; pass --ignore to snooze notices for current version
|
|
717
920
|
sync [path] Download/sync latest versioned OKF bundle to disk (default: package okf/ or custom dir)
|
|
718
921
|
list List all indexed statutory sections
|
|
719
922
|
init-skill [path] Install SKILL.md into your agent workspace (defaults to .agents/skills/)
|
|
@@ -725,6 +928,10 @@ Options:
|
|
|
725
928
|
--since <YYYY-MM-DD> Filter amendments taking effect on or after date (used in diff)
|
|
726
929
|
--section, -s <section> Filter amendments by section code (used in diff)
|
|
727
930
|
--domain <domain> Filter amendments by statutory domain (used in diff)
|
|
931
|
+
--verbose, -v Display full remediation steps, parameter schemas, and consequences in outcomes
|
|
932
|
+
--no-update-check Bypass automated background npm package update checks
|
|
933
|
+
--json, -j Emit clean, machine-parseable JSON to stdout (suppresses banners)
|
|
934
|
+
--offline, -o Bypass outbound network checks (air-gapped / offline environment mode)
|
|
728
935
|
--json, -j Emit clean, machine-parseable JSON to stdout (suppresses banners)
|
|
729
936
|
--offline, -o Bypass outbound network checks (air-gapped / offline environment mode)
|
|
730
937
|
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# MudraForge Statutory Architecture
|
|
2
2
|
## Grounding Financial AI in Deterministic Law & Open Knowledge
|
|
3
3
|
|
|
4
|
-
> **MudraForge Statutory Bundle**: `v2.
|
|
4
|
+
> **MudraForge Statutory Bundle**: `v2.9.0`
|
|
5
5
|
> **Knowledge Specification**: Google Open Knowledge Format (OKF) specification (upstream v0.2)
|
|
6
6
|
> **License**: MIT (Public Knowledge Commons)
|
|
7
7
|
> **Status**: Public Beta
|
|
@@ -592,10 +592,10 @@ Data traveling between tiers is encapsulated within a deterministic verification
|
|
|
592
592
|
|
|
593
593
|
```json
|
|
594
594
|
{
|
|
595
|
-
"protocolVersion": "okf/2.
|
|
595
|
+
"protocolVersion": "okf/2.9.0",
|
|
596
596
|
"domain": "direct_tax",
|
|
597
597
|
"sectionCode": "194Q",
|
|
598
|
-
"manifestDigest": "sha256-
|
|
598
|
+
"manifestDigest": "sha256-4bbe36c3db841b833dd2bebbd6c1c5ed735498e7b20d1221c323ceb211529fe0",
|
|
599
599
|
"effectiveTemporalStatus": "ACTIVE",
|
|
600
600
|
"canonicalParameters": {
|
|
601
601
|
"standardRatePercent": 0.1,
|
|
@@ -614,9 +614,9 @@ Data traveling between tiers is encapsulated within a deterministic verification
|
|
|
614
614
|
### 9.3 Edge Consistency & Eventual Consistency Resolution (Cloudflare KV)
|
|
615
615
|
|
|
616
616
|
Cloudflare Workers KV provides global low-latency reads via eventual consistency across edge nodes. To prevent release skew during regulatory updates:
|
|
617
|
-
1. *Immutable Version Tagging*: All statutory releases are written under unique semver namespaces (`statutory:releases:v2.
|
|
618
|
-
2. *Atomic Manifest Flip*: The global pointer `statutory:active_release` is updated only after all
|
|
619
|
-
3. *Cache-Control Invalidation*: Manifest responses carry strict validation headers (`ETag: "v2.
|
|
617
|
+
1. *Immutable Version Tagging*: All statutory releases are written under unique semver namespaces (`statutory:releases:v2.9.0:...`).
|
|
618
|
+
2. *Atomic Manifest Flip*: The global pointer `statutory:active_release` is updated only after all 86 files across all domains are fully confirmed across edge replicas.
|
|
619
|
+
3. *Cache-Control Invalidation*: Manifest responses carry strict validation headers (`ETag: "v2.9.0"`, `stale-while-revalidate=600`).
|
|
620
620
|
4. *Local Fallback*: If Tier 2 returns HTTP 5xx or fails DNS resolution, Tier 1 and Tier 3 automatically fall back to the bundled local filesystem snapshot without failing the active business transaction.
|
|
621
621
|
|
|
622
622
|
### 9.4 Architectural Boundaries: The Autonomous Coprocessor vs. Stateless Subsystems
|
|
@@ -733,10 +733,10 @@ To prevent version skew across regions, the edge runtime employs an **Immutable
|
|
|
733
733
|
1. **Immutable Artifact Keys**: Every section schema, circular, and form is stored under an immutable, version-tagged key:
|
|
734
734
|
```
|
|
735
735
|
statutory:releases:<semver>:<domain>:<section_code>
|
|
736
|
-
# Example: statutory:releases:v2.
|
|
736
|
+
# Example: statutory:releases:v2.9.0:direct_tax:194Q
|
|
737
737
|
```
|
|
738
738
|
Once written to KV, the bytes for a specific semver key are permanently immutable.
|
|
739
|
-
2. **Atomic Manifest Pointers**: Releases are indexed by a versioned root manifest (`statutory:manifests:v2.
|
|
739
|
+
2. **Atomic Manifest Pointers**: Releases are indexed by a versioned root manifest (`statutory:manifests:v2.9.0`). The active pointer is switched only after all constituent keys are fully populated.
|
|
740
740
|
3. **Cache Invalidation & ETag Gates**: The manifest endpoint serves HTTP `ETag` validators with short edge TTLs (`Cache-Control: public, max-age=60, s-maxage=300, stale-while-revalidate=600`). This ensures edge caches converge globally within minutes while allowing clients to detect release changes via deterministic SHA-256 root hash comparisons.
|
|
741
741
|
- **Commercial Boundary**: Only the automated, continuously maintained edge update stream, neural discovery search, and deep deterministic calculator engines require an Enterprise API subscription post-beta.
|
|
742
742
|
|
|
@@ -69,7 +69,7 @@ We establish three independent, non-interchangeable versioning dimensions:
|
|
|
69
69
|
| :--- | :--- | :--- | :--- |
|
|
70
70
|
| **`okfVersion`** | Knowledge Schema Structure | Incremented only when the JSON schema or metadata fields change (e.g., adding a required field). | `0.2.0` |
|
|
71
71
|
| **`corpusRelease`** | Legal Corpus Snapshot | Incremented when statutory provisions, rates, or circulars are updated or added. | `2026.04.1` |
|
|
72
|
-
| **`version`** (SemVer) | NPM Client SDK & CLI | Standard Semantic Versioning for the JavaScript library, CLI commands, and test runners. | `2.
|
|
72
|
+
| **`version`** (SemVer) | NPM Client SDK & CLI | Standard Semantic Versioning for the JavaScript library, CLI commands, and test runners. | `2.9.0` |
|
|
73
73
|
|
|
74
74
|
---
|
|
75
75
|
|
|
@@ -82,14 +82,15 @@ To maintain institutional credibility, public documentation must never blur the
|
|
|
82
82
|
|
|
83
83
|
| Subsystem / Capability | Architectural Layer | Operational Status | Availability / Access | Verification Evidence |
|
|
84
84
|
| :--- | :--- | :--- | :--- | :--- |
|
|
85
|
-
| **Bundled OKF Statutory Corpus (
|
|
85
|
+
| **Bundled OKF Statutory Corpus (29 Provisions across 5 Domains)** | Layer 1: Public Package | `PUBLIC_BUNDLED` | Immediate (Local repo & release candidate) | 80/80 test suites passing; SHA-256 Merkle root verified |
|
|
86
86
|
| **Zero-Network CLI (`mudraforge-statutory`)** | Layer 1: Public Package | `PUBLIC_BUNDLED` | Immediate (Global / NPX) | `bin/cli.js` verified across Windows & Linux |
|
|
87
87
|
| **Vendor-Neutral Conformance Suite** | Layer 1: Public Package | `PUBLIC_BUNDLED` | Immediate (`conformance/`) | 12/12 fixture tests passing |
|
|
88
88
|
| **Local Query SDK (`src/index.js`)** | Layer 1: Public Package | `PUBLIC_BUNDLED` | Immediate (Node.js v18+) | Zero-dependency offline lookup and temporal checks |
|
|
89
89
|
| **Synthetic AP Execution Trace (`examples/`)** | Layer 1: Public Package | `PUBLIC_DEMO_SYNTHETIC` | Immediate (`npm run example:trace`) | Modeled 7-stage lifecycle with synthetic test fixtures |
|
|
90
90
|
| **Cloudflare Anycast Edge Sync** | Layer 2: Public Edge Service | `PUBLIC_EDGE_SYNC` | Free Beta (`api.mudraforge.in`) | Cloudflare Edge Worker manifest & bundle endpoints |
|
|
91
91
|
| **Interactive API Documentation** | Layer 2: Public Edge Service | `PUBLIC_EDGE_SYNC` | Free Beta (`/api/v1/statutory/docs`) | OpenAPI 3.1 schema rendered live on Anycast edge |
|
|
92
|
-
| **Deterministic
|
|
92
|
+
| **Deterministic Calculators (7 Pure Functions)** | Layer 1: Public Package | `PUBLIC_BUNDLED` | Immediate (`@mudraforge/statutory/calculators`) | Corporate tax MAT vs concessional, GST POS/LUT, TP ALP, Section 79, Ind AS 109, Section 288B |
|
|
93
|
+
| **Hosted AP Engine & Cumulative Spend Tracking** | Layer 3: Enterprise Internal | `PILOT_STAGE_INTERNAL` | Metered Enterprise API (Selective) | Hosted cumulative Section 194Q thresholding & Section 16 MSMED interest |
|
|
93
94
|
| **Dual-Custody Mobile Approval Harness** | Layer 4: Adesha Runtime | `INTERNAL_PROTOTYPE` | Enterprise License / Pilot Proposal | Mobile passkey approval prototype & TLA+ state machine |
|
|
94
95
|
| **ERP Two-Way Connectors (SAP/Tally/Zoho)** | Layer 4: Adesha Runtime | `INTERNAL_DEVELOPMENT` | Custom Enterprise Pilot | Shadow-mode test connectors; no turnkey plug-ins shipped |
|
|
95
96
|
| **Bank Rail API Adapters (ICICI/HDFC/RazorpayX)**| Layer 4: Adesha Runtime | `INTERNAL_DEVELOPMENT` | Custom Enterprise Pilot | Sandbox banking adapters requiring corporate partner onboarding |
|
package/docs/CATALOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Statutory Knowledge Catalog
|
|
2
2
|
|
|
3
3
|
> **Institutional Reference Index**
|
|
4
|
-
> Package: `@mudraforge/statutory` | Version: `2.
|
|
4
|
+
> Package: `@mudraforge/statutory` | Version: `2.10.0` | Standard: `OKF v0.2`
|
|
5
5
|
> Epistemic Baseline: Union Budget 2025-26, Finance Act, 2025, and official executive gazettes.
|
|
6
6
|
|
|
7
7
|
This catalog is deterministically generated from the machine-readable Open Knowledge Format (`section.json`, executive circulars, and return schemas) bundled within this repository.
|
package/docs/CORPUS_QUALITY.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# MudraForge Statutory Knowledge Quality Card
|
|
2
2
|
|
|
3
3
|
> **Format Reference**: Inspired by Google's *Data Cards Playbook* and the OpenSSF Project Quality Standards.
|
|
4
|
-
> **Target Package**: `@mudraforge/statutory` v2.
|
|
4
|
+
> **Target Package**: `@mudraforge/statutory` v2.10.0
|
|
5
5
|
> **Evaluation Mode**: Machine-audited against primary sources, official gazettes, and test fixtures.
|
|
6
|
-
> **Generated Timestamp**: 2026-10-
|
|
6
|
+
> **Generated Timestamp**: 2026-10-26T21:04:24.978Z
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
| **Primary Source Citations** | 76 resolvable gazette URLs | 76 total citations declared | **100.0%** | VERIFIED |
|
|
15
15
|
| **Temporal Validity Bounds** | 29 sections with explicit dates | 29 total bundled sections | **100.0%** | VERIFIED |
|
|
16
16
|
| **Dual-Act 2025 Transition Bridges** | 9 direct tax provisions mapped | 10 direct tax provisions | **90.0%** | VERIFIED |
|
|
17
|
-
| **Attached Administrative Circulars** | 30 official circulars |
|
|
18
|
-
| **Attached Return/Compliance Schemas** | 27 schemas/templates |
|
|
19
|
-
| **Cryptographic Merkle Verification** |
|
|
17
|
+
| **Attached Administrative Circulars** | 30 official circulars | 29 provisions across active domains | **100% Attached** | VERIFIED |
|
|
18
|
+
| **Attached Return/Compliance Schemas** | 27 schemas/templates | 29 provisions across active domains | **100% Attached** | VERIFIED |
|
|
19
|
+
| **Cryptographic Merkle Verification** | 86 bundle files verified | SHA-256 Merkle root digest | **0 Mismatches** | VERIFIED |
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
## Public Package Seed vs. Full Sovereign Operating Engine
|
|
3
3
|
|
|
4
4
|
> **Document Version**: `1.0.0`
|
|
5
|
-
> **Package**: `@mudraforge/statutory` (v2.
|
|
5
|
+
> **Package**: `@mudraforge/statutory` (v2.9.0)
|
|
6
6
|
> **Enterprise Sovereign Engine**: MudraForge Adesha Sovereign Runtime
|
|
7
7
|
> **Specification**: Google Open Knowledge Format (OKF v0.2)
|
|
8
8
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
> **Document Type**: Architecture & Enterprise Governance Specification
|
|
5
5
|
> **Target Audience**: Chief Financial Officers (CFOs), Heads of Finance, Enterprise Security & Risk Teams
|
|
6
|
-
> **Underlying Substrate**: MudraForge Statutory Knowledge Layer (OKF)
|
|
6
|
+
> **Underlying Substrate**: MudraForge Statutory Knowledge Layer (OKF) — [`@mudraforge/statutory`](../README.md)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -17,25 +17,86 @@ When modern organizations adopt AI agents for finance operations, the primary ri
|
|
|
17
17
|
|
|
18
18
|
MudraForge Adesha was designed to establish an impenetrable **Execution Boundary** between generative AI assistance and real-world money movement.
|
|
19
19
|
|
|
20
|
+
> **The Core Thesis of Autonomous Finance**:
|
|
21
|
+
> *The dangerous moment in finance AI isn't when the model is wrong. It's when its output becomes a payment instruction.*
|
|
22
|
+
>
|
|
23
|
+
> In marketing, an AI hallucination is a typo. In accounts payable, an unhandled bank timeout can trigger a retry that double-pays a vendor.
|
|
24
|
+
>
|
|
25
|
+
> Hardening the financial runtime for **Adesha, MudraForge's organizational AI**, our principle is simple:
|
|
26
|
+
> **Reasoning can be probabilistic, but financial execution needs deterministic boundaries.**
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. The Three-Tier Architecture & Operational Boundaries
|
|
31
|
+
|
|
32
|
+
To ensure complete clarity for developers, auditors, and enterprise clients, MudraForge establishes three distinct architectural tiers with strict operational boundaries:
|
|
33
|
+
|
|
34
|
+
| Tier | Component | Repository & Distribution | Pricing & License | Operational Status |
|
|
35
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
36
|
+
| **Tier 1** | **Open-Source Statutory Commons** (`@mudraforge/statutory`) | Public GitHub (`mondeep0123/mudraforge-statutory`) & NPM Registry | **100% Free** (MIT License / CC BY 4.0 Data) | **`CURRENT_PRODUCTION`** (Working offline software) |
|
|
37
|
+
| **Tier 2** | **Hosted Statutory API & Edge Sync** | Cloudflare Global Anycast Edge (`api.mudraforge.in`) | Best-Effort Free Beta (Metered Cloud API) | **`CURRENT_BETA`** (Edge endpoints & caching) |
|
|
38
|
+
| **Tier 3** | **Commercial Adesha Runtime** | Enterprise Private VPC / On-Premise Worker Deployment | Commercial Enterprise SaaS | **`PILOT_STAGE_INTERNAL`** / **`SANDBOX_VALIDATED`** |
|
|
39
|
+
|
|
40
|
+
### Precise Status Classifications across Capabilities
|
|
41
|
+
|
|
42
|
+
To ensure epistemic honesty and prevent conflating tested prototypes with general availability:
|
|
43
|
+
|
|
44
|
+
- **`CURRENT_PRODUCTION` (Working, Publicly Inspectable Software)**:
|
|
45
|
+
- Bundled OKF statutory corpus (29 provisions across 5 legal domains).
|
|
46
|
+
- Pure deterministic calculators in `src/calculators.js` (Corporate Tax, LUT Export, TP ALP, Section 79, Ind AS 21/109).
|
|
47
|
+
- Zero-network CLI (`mudraforge-statutory` doctor, crosswalk, diff, verify, browse).
|
|
48
|
+
- Cryptographic SHA-256 Merkle root integrity verifier (`npm run manifest:check`).
|
|
49
|
+
- Native AI Agent Skill (`SKILL.md`) for offline agent runtime inspection.
|
|
50
|
+
|
|
51
|
+
- **`SANDBOX_VALIDATED` (Tested Under Realistic Simulation & Integration Sandboxes)**:
|
|
52
|
+
- Live Zoho Books general ledger balanced double-entry writeback (tested against sandbox and live accounts with readback).
|
|
53
|
+
- RazorpayX corporate banking sandbox payout dispatch (`SETTLEMENT_LIVE_SANDBOX`), HMAC-SHA256 webhook ingestion, and clearinghouse reversal interception.
|
|
54
|
+
- Multi-process lock contention testing verifying single-use lease acquisition across competing OS processes.
|
|
55
|
+
|
|
56
|
+
- **`PILOT_STAGE_INTERNAL` / `PLANNED` (Enterprise Engagements Requiring Partner Onboarding)**:
|
|
57
|
+
- Direct host-to-host bank rail settlement (ICICI / HDFC corporate host-to-host RTGS/NEFT).
|
|
58
|
+
- Multi-region distributed lease coordination across Cloudflare Durable Objects.
|
|
59
|
+
- Hosted Model Context Protocol (MCP) server fleets and live multi-agent tool connectivity (strictly enterprise tier).
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 3. The Four Pillars of Autonomous Finance Execution
|
|
64
|
+
|
|
65
|
+
1. **Retrieval is Not Verification**: Finding a document or matching keywords is not legal verification. Real accounting requires validating evidence against connected systems of record (including live Zoho Books / SAP ERP readback) and authenticated tenant statutory vaults.
|
|
66
|
+
2. **Safe Tools Do Not Guarantee Safe Workflows**: An AI agent can call individually safe API tools and still coordinate an unauthorized or illegal transaction. Generative models coordinate investigations; deterministic code calculates statutory taxes and enforces ledger invariants (*Rule 11: Agreement with the Engine ≠ Agreement with the Law*).
|
|
67
|
+
3. **Preventing Silent Financial Drift**: Deterministic code computes numbers. RFC 8785 JSON Canonicalization Scheme (JCS) and SHA-256 bind calculation results to a verifiable fingerprint. The hash does not compute—it detects changes between calculation, human authorization, and execution. If the result no longer matches the fingerprint, the workflow halts.
|
|
68
|
+
4. **Testing Payment Boundaries Against Failure**: Single-use CAS leases prevent duplicate payments under concurrent races. Formal TLA+ modeling with the TLC Model Checker explored all 361 reachable states in our configured distributed model with 0 invariant violations and caught 4 injected defects.
|
|
69
|
+
|
|
20
70
|
---
|
|
21
71
|
|
|
22
|
-
##
|
|
72
|
+
## 4. Seven-Stage End-to-End AP Governance Lifecycle
|
|
23
73
|
|
|
24
74
|
Every financial transaction in MudraForge Adesha passes through seven sequential verification gates before any funds can move or any ledger can mutate:
|
|
25
75
|
|
|
26
76
|
```
|
|
27
|
-
1
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
77
|
+
Stage 1: Invoice Ingestion (IRP QR Code / PDF & Vendor Validation)
|
|
78
|
+
↓
|
|
79
|
+
Stage 2: OKF Rule Resolution (Sub-1ms Local Offline Lookup)
|
|
80
|
+
↓
|
|
81
|
+
Stage 3: Deterministic Statutory Computation (Excess Math & GST Unbundling)
|
|
82
|
+
↓
|
|
83
|
+
Stage 4: Cryptographic Payment Authorization Lease (Single-Use Atomic CAS Gate)
|
|
84
|
+
↓
|
|
85
|
+
Stage 5: Human-in-the-Loop Authority Harness (CFO Biometric Passkey / Mobile)
|
|
86
|
+
↓
|
|
87
|
+
Stage 6: Bank Rail Settlement (Host-to-Host Corporate RTGS / Sandbox Rail)
|
|
88
|
+
↓
|
|
89
|
+
Stage 7: General Ledger Balanced Double-Entry Writeback (ERP Equilibrium: ₹0.00 Discrepancy)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Run this audited 7-stage AP simulation directly in your local terminal:
|
|
93
|
+
```bash
|
|
94
|
+
npm run example:trace
|
|
34
95
|
```
|
|
35
96
|
|
|
36
97
|
---
|
|
37
98
|
|
|
38
|
-
##
|
|
99
|
+
## 5. Cryptographic Single-Use Payment Authorization Leases
|
|
39
100
|
|
|
40
101
|
In Adesha, banking adapters (such as RazorpayX, Mercury, or host-to-host SFTP connections) operate within a **Zero-Trust Execution Boundary**.
|
|
41
102
|
|
|
@@ -64,7 +125,7 @@ A payment lease is cryptographically bound to seven immutable parameters:
|
|
|
64
125
|
|
|
65
126
|
---
|
|
66
127
|
|
|
67
|
-
##
|
|
128
|
+
## 6. Presentation Consistency Lock & Automated Prose Auditor
|
|
68
129
|
|
|
69
130
|
Generative language models regularly drop trailing zeros or swap figures when drafting summaries for human reviewers.
|
|
70
131
|
|
|
@@ -77,22 +138,20 @@ Adesha enforces a **Presentation Consistency Lock**:
|
|
|
77
138
|
|
|
78
139
|
---
|
|
79
140
|
|
|
80
|
-
##
|
|
81
|
-
|
|
82
|
-
### 1. Penny-Drop Verification
|
|
83
|
-
Before any vendor account can be bound to a payment lease, it must complete an automated automated penny-drop verification via NPCI/IMPS with a verified name-match score $\ge 95\%$.
|
|
141
|
+
## 7. OpenSSF Packaging vs. Full Security Assurance
|
|
84
142
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Banking API credentials (API keys, OAuth client secrets, mTLS certificates) reside inside an isolated secret boundary accessible exclusively through a cryptographic signing module that demands an active, unconsumed `PaymentAuthorizationLease`.
|
|
143
|
+
In accordance with OpenSSF (Open Source Security Foundation) npm best practices:
|
|
144
|
+
- **Packaging Hygiene**: Zero runtime dependencies, offline-first execution, and `.npmrc` with `ignore-scripts=true` neutralize install-time supply chain attacks.
|
|
145
|
+
- **Cryptographic Non-Tampering**: SHA-256 Merkle root manifests certify byte-level distribution fidelity.
|
|
146
|
+
- **Epistemic Honesty**: These packaging strengths do not replace independent legal counsel, statutory audit certification, or runtime multi-region crash testing. Organizations must evaluate autonomous finance systems against end-to-end integration boundaries.
|
|
90
147
|
|
|
91
148
|
---
|
|
92
149
|
|
|
93
|
-
##
|
|
150
|
+
## 8. Commercial Engagement & Enterprise Pilots
|
|
151
|
+
|
|
152
|
+
The full Adesha Autonomous Governance Runtime is delivered as a managed enterprise deployment integrated with your corporate ERP (Zoho Books, SAP S/4HANA, NetSuite) and banking partners.
|
|
94
153
|
|
|
95
|
-
|
|
154
|
+
To evaluate Adesha in read-only shadow mode against historical accounts payable records, review the [Supervised Shadow Pilot Evaluation Guide](./PILOT_EVALUATION_GUIDE.md).
|
|
96
155
|
|
|
97
156
|
For enterprise architecture discussions, pilot deployments, or API keys:
|
|
98
157
|
- **Email**: [hello@mudraforge.in](mailto:hello@mudraforge.in) or [support@mudraforge.in](mailto:support@mudraforge.in)
|