pramana-protocol 1.0.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/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # pramana-protocol
2
+
3
+ **PRAMANA/1.0** — A Self-Verifying Cognition Protocol for AI-Native Service Universes
4
+
5
+ > Named after Dharmakīrti's epistemological framework (c. 600–660 CE, Nalanda). *Pramana* = valid cognition.
6
+
7
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19273330.svg)](https://zenodo.org/records/19273330)
8
+ [![npm](https://img.shields.io/npm/v/pramana-protocol)](https://www.npmjs.com/package/pramana-protocol)
9
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
10
+
11
+ ---
12
+
13
+ ## The Problem
14
+
15
+ At 200+ AI services, capability registries decay into stale documentation. Services claim capabilities they no longer have. Knowledge bases contain rules that were never validated. Routing succeeds while cognition fails. **Declaration without proof is hallucination at scale.**
16
+
17
+ ## The Protocol
18
+
19
+ Three intertwined strands. Four signals. Five authenticity levels. One return signal that closes the loop.
20
+
21
+ ```
22
+ Strand 1 — CAPABILITY What services exist and what they can do (AnkrCodex-compatible)
23
+ Strand 2 — KNOWLEDGE Domain rules — SHASTRA / YUKTI / VIVEKA (Knowledge Codex-compatible)
24
+ Strand 3 — PROOF Implementation matches declaration (CCA-compatible)
25
+ ```
26
+
27
+ ```
28
+ Signal 1 — STATE What the service knows and can do
29
+ Signal 2 — TRUST What is authorised
30
+ Signal 3 — SENSE What is happening now
31
+ Signal 4 — PHALA Delivery outcome → returned to SOURCE RULE ← the novel signal
32
+ ```
33
+
34
+ **PHALA** closes the loop. Every delivery outcome returns to the *rule that generated the answer* — not the service log. Wrong outcomes trigger RCA. Correct outcomes reaffirm the rule. The system learns from every transaction.
35
+
36
+ ## Authenticity Markers
37
+
38
+ Every output carries a marker. Never a percentage. A binary checklist per strand.
39
+
40
+ | Level | Label | Action |
41
+ |---|---|---|
42
+ | PRAMANA-0 | UNVERIFIED | **Mandatory human check — do not act** |
43
+ | PRAMANA-1 | SINGLE SOURCE | Verify independently. System explains which strand + why it answered. |
44
+ | PRAMANA-2 | PARTIAL AUTHENTIC | Missing strand named explicitly. Proceed with caution. |
45
+ | PRAMANA-3 | AUTHENTIC | All three strands confirmed. Reliable. |
46
+ | PRAMANA-3+ | AUTHENTICATED + INFERRED | Full coverage + SLM inference. Highest confidence. |
47
+
48
+ ## Install
49
+
50
+ ```bash
51
+ npm install pramana-protocol
52
+ ```
53
+
54
+ ## Usage
55
+
56
+ ```typescript
57
+ import {
58
+ STRAND, SIGNAL, PRAMANA_LEVEL,
59
+ getPramanaLevel, buildMarker,
60
+ PhalaPayload
61
+ } from 'pramana-protocol';
62
+
63
+ // Determine authenticity level from available strands
64
+ const level = getPramanaLevel(
65
+ [STRAND.CAPABILITY, STRAND.KNOWLEDGE], // proof strand missing
66
+ false // SLM not available
67
+ );
68
+ // → PRAMANA_LEVEL.PARTIAL_AUTHENTIC (2)
69
+
70
+ // Build a display marker for the output
71
+ const marker = buildMarker(
72
+ [STRAND.CAPABILITY, STRAND.KNOWLEDGE],
73
+ false,
74
+ 'Proof strand unavailable — CCA not yet run for this service'
75
+ );
76
+ // → { level: 2, label: 'PRAMANA-2 — PARTIAL AUTHENTIC', strands_missing: ['proof'], ... }
77
+
78
+ // PHALA payload — fire on every delivery outcome
79
+ const phala: PhalaPayload = {
80
+ signal_type: 'phala',
81
+ rule_id: 'MAR-YK-007',
82
+ applied_by: 'mari8x-legal',
83
+ query_context: 'charter party clause, English law',
84
+ outcome: 'failure',
85
+ strands_available: [STRAND.CAPABILITY, STRAND.KNOWLEDGE],
86
+ strand_missing: [STRAND.PROOF],
87
+ authenticity_level: PRAMANA_LEVEL.PARTIAL_AUTHENTIC,
88
+ rca_triggered: true,
89
+ timestamp: new Date().toISOString()
90
+ };
91
+ ```
92
+
93
+ ## Reference Implementation
94
+
95
+ **ANKR** is Customer Zero — 200+ services running PRAMANA/1.0.
96
+
97
+ - AnkrCodex (capability registry) — Strand 1
98
+ - GRANTHX Knowledge Codex (5,336 rules, SHASTRA/YUKTI/VIVEKA) — Strand 2
99
+ - CCA Capability Closure Audit (174 services audited) — Strand 3
100
+ - PHALA signal wired across all services
101
+
102
+ ## Protocol Specification
103
+
104
+ Full RFC-style spec: [PROTOCOL.md](PROTOCOL.md)
105
+
106
+ Academic paper (Zenodo DOI: 10.5281/zenodo.19273330): [PAPER.md](PAPER.md)
107
+
108
+ ## Built on Forja
109
+
110
+ PRAMANA is the cognition layer built on top of the Forja declaration protocol.
111
+
112
+ ```
113
+ Forja = declaration protocol (what a service IS and can do)
114
+ PRAMANA = cognition protocol (whether that declaration holds under real usage)
115
+ ```
116
+
117
+ - Forja: [rocketlang/forja-protocol](https://github.com/rocketlang/forja-protocol)
118
+ - Trust constants: [ankr-trust-constants](https://www.npmjs.com/package/ankr-trust-constants)
119
+
120
+ ## Author
121
+
122
+ **Capt. Anil Kumar Sharma**
123
+ PowerPbox IT Solutions Pvt Ltd
124
+ capt.anil.sharma@powerpbox.org
125
+
126
+ DPIIT Registered Startup, Haryana, India
127
+
128
+ ## License
129
+
130
+ Apache 2.0 — see [LICENSE](LICENSE)
@@ -0,0 +1,66 @@
1
+ /**
2
+ * pramana-protocol — Core constants and types for the PRAMANA/1.0 cognition protocol
3
+ * https://zenodo.org/records/19273330
4
+ *
5
+ * Author: Capt. Anil Kumar Sharma, PowerPbox IT Solutions Pvt Ltd
6
+ * License: Apache-2.0
7
+ */
8
+ export declare const PRAMANA_LEVEL: {
9
+ /** No strand available. Mandatory human check. Never act on this output. */
10
+ readonly UNVERIFIED: 0;
11
+ /** One strand only. System must explain which strand and why it answered. */
12
+ readonly SINGLE_SOURCE: 1;
13
+ /** Two strands confirmed. Missing strand must be named explicitly. */
14
+ readonly PARTIAL_AUTHENTIC: 2;
15
+ /** All three strands confirmed. Reliable. */
16
+ readonly AUTHENTIC: 3;
17
+ /** Full strand coverage + SLM Purva-paksha inference applied. */
18
+ readonly AUTHENTICATED_INFERRED: 4;
19
+ };
20
+ export type PramanaLevel = typeof PRAMANA_LEVEL[keyof typeof PRAMANA_LEVEL];
21
+ export declare const PRAMANA_LABEL: Record<PramanaLevel, string>;
22
+ export declare const PRAMANA_ACTION: Record<PramanaLevel, string>;
23
+ export declare const STRAND: {
24
+ readonly CAPABILITY: "capability";
25
+ readonly KNOWLEDGE: "knowledge";
26
+ readonly PROOF: "proof";
27
+ };
28
+ export type StrandType = typeof STRAND[keyof typeof STRAND];
29
+ export declare const SIGNAL: {
30
+ readonly STATE: "state";
31
+ readonly TRUST: "trust";
32
+ readonly SENSE: "sense";
33
+ readonly PHALA: "phala";
34
+ };
35
+ export type SignalType = typeof SIGNAL[keyof typeof SIGNAL];
36
+ export interface PhalaPayload {
37
+ signal_type: 'phala';
38
+ rule_id: string;
39
+ applied_by: string;
40
+ query_context: string;
41
+ outcome: 'success' | 'failure' | 'partial';
42
+ strands_available: StrandType[];
43
+ strand_missing: StrandType[];
44
+ authenticity_level: PramanaLevel;
45
+ rca_triggered: boolean;
46
+ slm_available?: boolean;
47
+ timestamp: string;
48
+ }
49
+ export declare const RCA_FAILURE: {
50
+ readonly ROUTING: "routing";
51
+ readonly APPLICATION: "application";
52
+ readonly RULE: "rule";
53
+ readonly UNKNOWN: "unknown";
54
+ };
55
+ export type RcaFailureType = typeof RCA_FAILURE[keyof typeof RCA_FAILURE];
56
+ export declare function getPramanaLevel(strandsAvailable: StrandType[], slmAvailable?: boolean): PramanaLevel;
57
+ export interface AuthenticityMarker {
58
+ level: PramanaLevel;
59
+ label: string;
60
+ action: string;
61
+ strands_present: StrandType[];
62
+ strands_missing: StrandType[];
63
+ explanation?: string;
64
+ }
65
+ export declare function buildMarker(strandsAvailable: StrandType[], slmAvailable?: boolean, explanation?: string): AuthenticityMarker;
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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YAAY,CAOd;AAID,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,WAAW,CACzB,gBAAgB,EAAE,UAAU,EAAE,EAC9B,YAAY,UAAQ,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB,CAapB"}
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /**
3
+ * pramana-protocol — Core constants and types for the PRAMANA/1.0 cognition protocol
4
+ * https://zenodo.org/records/19273330
5
+ *
6
+ * Author: Capt. Anil Kumar Sharma, PowerPbox IT Solutions Pvt Ltd
7
+ * License: Apache-2.0
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.RCA_FAILURE = exports.SIGNAL = exports.STRAND = exports.PRAMANA_ACTION = exports.PRAMANA_LABEL = exports.PRAMANA_LEVEL = void 0;
11
+ exports.getPramanaLevel = getPramanaLevel;
12
+ exports.buildMarker = buildMarker;
13
+ // ── Authenticity Levels ────────────────────────────────────────────────────────
14
+ exports.PRAMANA_LEVEL = {
15
+ /** No strand available. Mandatory human check. Never act on this output. */
16
+ UNVERIFIED: 0,
17
+ /** One strand only. System must explain which strand and why it answered. */
18
+ SINGLE_SOURCE: 1,
19
+ /** Two strands confirmed. Missing strand must be named explicitly. */
20
+ PARTIAL_AUTHENTIC: 2,
21
+ /** All three strands confirmed. Reliable. */
22
+ AUTHENTIC: 3,
23
+ /** Full strand coverage + SLM Purva-paksha inference applied. */
24
+ AUTHENTICATED_INFERRED: 4,
25
+ };
26
+ exports.PRAMANA_LABEL = {
27
+ 0: 'PRAMANA-0 — UNVERIFIED',
28
+ 1: 'PRAMANA-1 — SINGLE SOURCE',
29
+ 2: 'PRAMANA-2 — PARTIAL AUTHENTIC',
30
+ 3: 'PRAMANA-3 — AUTHENTIC',
31
+ 4: 'PRAMANA-3+ — AUTHENTICATED + INFERRED',
32
+ };
33
+ exports.PRAMANA_ACTION = {
34
+ 0: 'MANDATORY HUMAN CHECK — do not act on this output',
35
+ 1: 'Verify independently before relying on this output',
36
+ 2: 'Proceed with caution — check missing strand before acting',
37
+ 3: 'Reliable — proceed',
38
+ 4: 'Highest available confidence — proceed',
39
+ };
40
+ // ── Strand Types ───────────────────────────────────────────────────────────────
41
+ exports.STRAND = {
42
+ CAPABILITY: 'capability', // AnkrCodex — what services exist and what they can do
43
+ KNOWLEDGE: 'knowledge', // Knowledge Codex — domain rules (SHASTRA/YUKTI/VIVEKA)
44
+ PROOF: 'proof', // CCA — implementation matches declaration
45
+ };
46
+ // ── Signal Types ───────────────────────────────────────────────────────────────
47
+ exports.SIGNAL = {
48
+ STATE: 'state', // What the service knows and can do
49
+ TRUST: 'trust', // What is authorised
50
+ SENSE: 'sense', // What is happening now
51
+ PHALA: 'phala', // Delivery outcome — returned to source RULE (the novel signal)
52
+ };
53
+ // ── RCA Failure Types ──────────────────────────────────────────────────────────
54
+ exports.RCA_FAILURE = {
55
+ ROUTING: 'routing', // Wrong service received the query
56
+ APPLICATION: 'application', // Right service, rule applied incorrectly
57
+ RULE: 'rule', // Rule itself is wrong or outdated
58
+ UNKNOWN: 'unknown', // Cannot classify — escalate to human
59
+ };
60
+ // ── Strand Availability → PRAMANA Level ───────────────────────────────────────
61
+ function getPramanaLevel(strandsAvailable, slmAvailable = false) {
62
+ const count = strandsAvailable.length;
63
+ if (count === 0)
64
+ return exports.PRAMANA_LEVEL.UNVERIFIED;
65
+ if (count === 1)
66
+ return exports.PRAMANA_LEVEL.SINGLE_SOURCE;
67
+ if (count === 2)
68
+ return exports.PRAMANA_LEVEL.PARTIAL_AUTHENTIC;
69
+ if (count >= 3 && slmAvailable)
70
+ return exports.PRAMANA_LEVEL.AUTHENTICATED_INFERRED;
71
+ return exports.PRAMANA_LEVEL.AUTHENTIC;
72
+ }
73
+ function buildMarker(strandsAvailable, slmAvailable = false, explanation) {
74
+ const level = getPramanaLevel(strandsAvailable, slmAvailable);
75
+ const allStrands = Object.values(exports.STRAND);
76
+ const missing = allStrands.filter(s => !strandsAvailable.includes(s));
77
+ return {
78
+ level,
79
+ label: exports.PRAMANA_LABEL[level],
80
+ action: exports.PRAMANA_ACTION[level],
81
+ strands_present: strandsAvailable,
82
+ strands_missing: missing,
83
+ ...(level < exports.PRAMANA_LEVEL.AUTHENTIC && explanation ? { explanation } : {}),
84
+ };
85
+ }
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAqFH,0CAUC;AAaD,kCAiBC;AA3HD,kFAAkF;AAErE,QAAA,aAAa,GAAG;IAC3B,4EAA4E;IAC5E,UAAU,EAAE,CAAC;IACb,6EAA6E;IAC7E,aAAa,EAAE,CAAC;IAChB,sEAAsE;IACtE,iBAAiB,EAAE,CAAC;IACpB,6CAA6C;IAC7C,SAAS,EAAE,CAAC;IACZ,iEAAiE;IACjE,sBAAsB,EAAE,CAAC;CACjB,CAAC;AAIE,QAAA,aAAa,GAAiC;IACzD,CAAC,EAAE,wBAAwB;IAC3B,CAAC,EAAE,2BAA2B;IAC9B,CAAC,EAAE,+BAA+B;IAClC,CAAC,EAAE,uBAAuB;IAC1B,CAAC,EAAE,uCAAuC;CAC3C,CAAC;AAEW,QAAA,cAAc,GAAiC;IAC1D,CAAC,EAAE,mDAAmD;IACtD,CAAC,EAAE,oDAAoD;IACvD,CAAC,EAAE,2DAA2D;IAC9D,CAAC,EAAE,oBAAoB;IACvB,CAAC,EAAE,wCAAwC;CAC5C,CAAC;AAEF,kFAAkF;AAErE,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE,YAAY,EAAI,uDAAuD;IACnF,SAAS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E,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtE,OAAO;QACL,KAAK;QACL,KAAK,EAAE,qBAAa,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,sBAAc,CAAC,KAAK,CAAC;QAC7B,eAAe,EAAE,gBAAgB;QACjC,eAAe,EAAE,OAAO;QACxB,GAAG,CAAC,KAAK,GAAG,qBAAa,CAAC,SAAS,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "pramana-protocol",
3
+ "version": "1.0.0",
4
+ "description": "PRAMANA/1.0 — A Self-Verifying Cognition Protocol for AI-Native Service Universes. Three strands. Four signals. Five authenticity levels. The PHALA signal closes the loop.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "PROTOCOL.md",
10
+ "PAPER.md",
11
+ "LICENSE"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "keywords": [
18
+ "pramana",
19
+ "ai-protocol",
20
+ "capability-registry",
21
+ "knowledge-codex",
22
+ "phala-signal",
23
+ "authenticity-marker",
24
+ "rca-loop",
25
+ "forja",
26
+ "ankr",
27
+ "dharmakirti"
28
+ ],
29
+ "author": "Capt. Anil Kumar Sharma <capt.anil.sharma@powerpbox.org> (PowerPbox IT Solutions Pvt Ltd)",
30
+ "license": "Apache-2.0",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/rocketlang/pramana-protocol.git"
34
+ },
35
+ "homepage": "https://zenodo.org/records/19273330",
36
+ "devDependencies": {
37
+ "typescript": "^5.9.3"
38
+ }
39
+ }