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/PROTOCOL.md ADDED
@@ -0,0 +1,919 @@
1
+ # PRAMANA/1.0
2
+
3
+ ## Open Protocol Specification for Authenticated AI Knowledge Delivery
4
+
5
+ ```
6
+ Document: PRAMANA/1.0
7
+ Status: OPEN DRAFT — Reference Implementation by ANKR
8
+ Version: 1.0.0
9
+ Date: 2026-03-28
10
+ Author: Capt. Anil Kumar Sharma
11
+ PowerPbox IT Solutions Pvt Ltd
12
+ capt.anil.sharma@powerpbox.org
13
+ +91-7506926394
14
+ DPIIT Registered Startup, Haryana, India
15
+ ```
16
+
17
+ ---
18
+
19
+ ## 1. Status of This Document
20
+
21
+ This document describes an open protocol specification. Any system, organisation, or individual
22
+ may implement the PRAMANA protocol. The protocol is not the exclusive property of any
23
+ implementer. ANKR (PowerPbox IT Solutions Pvt Ltd) is the reference implementation author and
24
+ maintains the canonical specification.
25
+
26
+ The reference implementation is available at:
27
+ - GitHub: https://github.com/rocketlang/forja-protocol
28
+ - npm: ankr-forja (AnkrForja STATE/TRUST/SENSE/PHALA primitives)
29
+ - npm: ankr-trust-constants (bitmask constants and strand type registry)
30
+
31
+ This document establishes the priority date of 2026-03-28 for the PRAMANA/1.0 protocol design.
32
+ Provisional patent applications covering PHALA signal routing, the PRAMANA Authenticity Marker
33
+ System, SLM Self-Training via RCA Corrections, and Two-Wrong-Equals-Right Detection have been
34
+ filed as of this date.
35
+
36
+ Implementers are encouraged to contribute strand type registrations, extensions, and
37
+ interoperability notes via the public repository.
38
+
39
+ ---
40
+
41
+ ## 2. Abstract
42
+
43
+ PRAMANA/1.0 defines a protocol for AI knowledge delivery systems to verify, annotate, and
44
+ continuously improve the authenticity of their outputs. The protocol introduces four signals
45
+ (STATE, TRUST, SENSE, and the novel PHALA signal), a five-level Authenticity Marker system, and
46
+ a recursive mini-loop operating at every stage of the delivery pipeline. PRAMANA addresses the
47
+ structural inability of current AI systems to distinguish between what they know and what they
48
+ merely compute — and to route that distinction to the user and back to the source rule in a
49
+ machine-readable, actionable form.
50
+
51
+ The word Pramana (Sanskrit: प्रमाण) means valid cognition — knowledge that can be authenticated
52
+ as arising from a reliable source. In the epistemology of Dharmakīrti (Nalanda, c. 600–660 CE),
53
+ Pramana is not merely belief but verifiable knowing. This protocol applies that standard to AI
54
+ system output.
55
+
56
+ ---
57
+
58
+ ## 3. Introduction
59
+
60
+ AI systems deployed in professional and regulatory domains produce outputs that users act upon.
61
+ The quality of those outputs depends on three structurally independent factors:
62
+
63
+ 1. Whether the system is actually capable of answering the query type (capability).
64
+ 2. Whether the knowledge the system draws on is authoritative (knowledge authenticity).
65
+ 3. Whether the system has been independently verified to behave as specified (proof of
66
+ conformance).
67
+
68
+ These three factors are not captured by a scalar confidence score. A system can be 98% confident
69
+ in an answer that is produced by the wrong capability, drawn from an unverified knowledge source,
70
+ and generated by a system that has never been independently audited. Conversely, a system may
71
+ produce a correct answer at low statistical confidence because it is operating at the edge of its
72
+ knowledge — but that answer may be fully authenticated because all three strands are present.
73
+
74
+ PRAMANA/1.0 defines a minimal, extensible protocol that enables any AI knowledge system to:
75
+
76
+ (a) Check the binary availability of independent validation strands at query time.
77
+ (b) Annotate every output with a structured Authenticity Level.
78
+ (c) Route delivery outcomes back to the specific knowledge rules that generated them.
79
+ (d) Trigger root cause analysis at rule granularity, not service granularity.
80
+ (e) Optionally connect a Small Language Model plugin to capture human-validated corrections as
81
+ fine-tuning data within the normal RCA workflow.
82
+
83
+ The protocol is designed to be implemented incrementally. A minimum viable implementation
84
+ requires one strand and basic PHALA routing. A full implementation provides all four signals,
85
+ all five authenticity levels, and an SLM plugin interface.
86
+
87
+ ---
88
+
89
+ ## 4. Terminology
90
+
91
+ The following terms are used throughout this specification. Where a term has a corresponding
92
+ Sanskrit root, that root is noted for reference.
93
+
94
+ **Strand**
95
+ An independent, structurally distinct category of validation that can be applied to an AI system
96
+ output. Each strand is checked at query time as a binary (present/absent). Strands are not
97
+ additive sub-components of a single confidence score — they are orthogonal dimensions of
98
+ authenticity. The minimum required strands for a PRAMANA/1.0 implementation are Capability and
99
+ Knowledge. A third strand, Proof, is defined in this specification. Additional strands may be
100
+ registered (see Section 15).
101
+
102
+ **Signal**
103
+ A structured data event emitted by a PRAMANA-compatible AI system at a defined point in the
104
+ query lifecycle. This specification defines four signals: STATE, TRUST, SENSE, and PHALA.
105
+
106
+ **Authenticity Level**
107
+ A discrete classification from 0 to 3+ assigned to an AI system output, representing the count
108
+ and combination of validation strands available at the time the output was generated. Authenticity
109
+ Level is not a confidence score and must not be presented as one.
110
+
111
+ **PHALA**
112
+ (Sanskrit: फल — phala — outcome, fruit, result.) The fourth signal in the PRAMANA protocol. A
113
+ PHALA signal carries a delivery outcome (success or failure) from the point of delivery back to
114
+ the specific knowledge rule or rules that generated the AI response. PHALA is the mechanism by
115
+ which the protocol closes the feedback loop at rule granularity. See Section 7.4.
116
+
117
+ **RCA**
118
+ Root Cause Analysis. In the context of this protocol, RCA is triggered at the rule level when
119
+ a PHALA signal aggregate for a specific Rule ID crosses a failure threshold. RCA is a
120
+ human-in-the-loop process. It cannot be fully automated (see Section 10.2).
121
+
122
+ **Purva-paksha**
123
+ (Sanskrit: पूर्वपक्ष — the prior position; the opposing view presented before the conclusion.)
124
+ In the context of this protocol, the Purva-paksha is a hypothesis generated by an SLM Plugin
125
+ during the RCA process — the SLM's inference about the cause of a failure and a proposed
126
+ correction. The Purva-paksha is presented to a human expert for validation. It is an input to
127
+ human judgment, not a replacement for it.
128
+
129
+ **Siddhanta**
130
+ (Sanskrit: सिद्धान्त — established conclusion; that which has been proven.) In the context of
131
+ this protocol, the Siddhanta is the human expert's validated conclusion at the close of an RCA
132
+ work item. The Siddhanta becomes the labeled training output in the SLM fine-tuning pair
133
+ (see Section 10.3).
134
+
135
+ **SLM Plugin**
136
+ A Small Language Model optionally connected to the PRAMANA RCA loop. The SLM Plugin is scoped
137
+ to one or more Rule IDs and fires Purva-paksha inferences during RCA. It receives fine-tuning
138
+ updates from Siddhanta-labeled training pairs. The SLM Plugin interface is defined in
139
+ Section 10.3.
140
+
141
+ **Rule ID**
142
+ A unique identifier assigned to each knowledge rule, statute, inference, or knowledge node in a
143
+ PRAMANA-compatible system's Rule Registry. Rule IDs are the primary routing key for PHALA
144
+ signals. Format is implementation-defined; the reference implementation uses the pattern
145
+ `{DOMAIN}-{TYPE}-{NUM}` (e.g., `MAR-YK-007`, `INF-LL-001`).
146
+
147
+ **Query Registry**
148
+ A registry maintained by a PRAMANA-compatible system that maps query types to expected minimum
149
+ Authenticity Levels and other per-query metadata.
150
+
151
+ **Rule Registry**
152
+ A registry maintained by a PRAMANA-compatible system that maps Rule IDs to knowledge content,
153
+ PHALA aggregate counters, and SLM Plugin assignments.
154
+
155
+ **Rule-Level Outcome Registry**
156
+ A persistent store keyed by Rule ID, receiving PHALA signals and maintaining per-rule delivery
157
+ outcome aggregates. Logically distinct from the service log or model log.
158
+
159
+ ---
160
+
161
+ ## 5. Protocol Overview
162
+
163
+ A PRAMANA/1.0 compatible system implements the following lifecycle per query:
164
+
165
+ ```
166
+ QUERY RECEIVED
167
+ |
168
+ v
169
+ [STATE check] — Is this system operational? What are its declared capabilities?
170
+ |
171
+ v
172
+ [TRUST check] — Is this user/role authorised for this query type?
173
+ |
174
+ v
175
+ [Strand checks] — For each defined strand: is it available? (binary per strand)
176
+ |
177
+ v
178
+ [Authenticity Level assigned] — Based on strand count and identity
179
+ |
180
+ v
181
+ [Rule IDs recorded] — Which rules contribute to this response?
182
+ |
183
+ v
184
+ [OUTPUT DELIVERED] — With PRAMANA annotation attached
185
+ |
186
+ v
187
+ [SENSE emitted] — System-level event (delivery attempted)
188
+ |
189
+ v
190
+ [Outcome received] — Success/failure signal from user or downstream system
191
+ |
192
+ v
193
+ [PHALA generated] — Routed to Rule-Level Outcome Registry per Rule ID
194
+ |
195
+ v
196
+ [PHALA aggregate] — Per Rule ID: counters updated, threshold check
197
+ |
198
+ v
199
+ [RCA trigger?] — If threshold crossed: open RCA work item
200
+ |
201
+ v
202
+ [RCA loop] — Human review, optional SLM Purva-paksha, Siddhanta capture
203
+ |
204
+ v
205
+ [Training pair] — Appended to SLM fine-tuning queue (if SLM Plugin present)
206
+ ```
207
+
208
+ The recursive mini-loop READ → ROUTE → RECORD operates at every stage. Every check reads state,
209
+ routes the query or signal appropriately, and records the outcome for the next stage.
210
+
211
+ ---
212
+
213
+ ## 6. The Three Strands
214
+
215
+ ### 6.1 Strand 1 — Capability
216
+
217
+ **Strand Type ID:** `capability`
218
+
219
+ **Definition:** Binary check — is the responding service or agent independently confirmed as
220
+ capable of answering this query type via a centralised capability registry?
221
+
222
+ **How to check:** Query a capability registry (AnkrCodex-compatible or equivalent) for the
223
+ responding service's declared `can_answer` list. If the query type slug is present in the list,
224
+ the strand is available.
225
+
226
+ **AnkrCodex compatibility:** A service implementing the AnkrForja STATE endpoint
227
+ (`GET /api/v2/forja/state`) and declaring `can_answer` in its `codex.json` is Strand 1 capable
228
+ by default.
229
+
230
+ **Absence implication:** The system has answered a query type that it has not declared as within
231
+ its capability, or the capability registry is unavailable. The Authenticity Level cannot exceed
232
+ PRAMANA-1 if Strand 1 is absent.
233
+
234
+ ### 6.2 Strand 2 — Knowledge
235
+
236
+ **Strand Type ID:** `knowledge`
237
+
238
+ **Definition:** Binary check — is the knowledge source used to generate the response
239
+ independently confirmed as authoritative for the query domain, via a knowledge indexing system?
240
+
241
+ **How to check:** Query a knowledge codex (GRANTHX-compatible or equivalent) for the Rule IDs
242
+ or knowledge nodes cited in the response. If those IDs exist in the indexed codex and are
243
+ classified as authoritative for the query domain, the strand is available.
244
+
245
+ **GRANTHX compatibility:** A service whose LOGICS documents have been indexed in GRANTHX
246
+ (or any compatible knowledge codex implementing the `.ib` or equivalent interchange format)
247
+ is Strand 2 capable for the indexed rules.
248
+
249
+ **Absence implication:** The system has answered using knowledge that has not been independently
250
+ indexed or verified as authoritative. The Authenticity Level cannot exceed PRAMANA-2 if
251
+ Strand 2 is absent.
252
+
253
+ ### 6.3 Strand 3 — Proof
254
+
255
+ **Strand Type ID:** `proof`
256
+
257
+ **Definition:** Binary check — has the responding service been independently verified to behave
258
+ in accordance with its declared specification, via a conformance verification system?
259
+
260
+ **How to check:** Query the service's PROOF endpoint (`GET /api/v2/forja/proof` in the reference
261
+ implementation) or a centralised conformance registry. If the service's proof coverage meets the
262
+ minimum threshold (default: 90% annotation coverage per the reference implementation), the
263
+ strand is available.
264
+
265
+ **CCA compatibility:** A service that has completed a Capability Closure Audit (CCA) and
266
+ maintains `coverage_pct >= 90.0` in its `codex.json` `proof_config` block is Strand 3 capable.
267
+
268
+ **Absence implication:** The service has not been independently verified to behave as specified.
269
+ The Authenticity Level is PRAMANA-2 if Strands 1 and 2 are present but Strand 3 is absent.
270
+
271
+ ### 6.4 Partial Strand Operation
272
+
273
+ A PRAMANA/1.0 implementation MUST NOT refuse to answer a query solely because one or more
274
+ strands are unavailable. The protocol does not gate delivery on authentication — it annotates
275
+ delivery with its authentication state. Refusing to answer is a policy decision by the
276
+ implementing system and is outside the scope of this protocol.
277
+
278
+ The minimum viable implementation requires one strand. A system with zero strands available
279
+ assigns PRAMANA-0 and MUST attach the mandatory human review flag.
280
+
281
+ ### 6.5 Extended Strands
282
+
283
+ Implementers may define additional strands beyond the three defined in this specification. Each
284
+ extended strand MUST be registered with a unique Strand Type ID (see Section 15). Extended
285
+ strands contribute to the Authenticity Level calculation as follows:
286
+
287
+ - If all defined strands (including extended) are present: PRAMANA-3 (or PRAMANA-3+ if SLM
288
+ Plugin is active).
289
+ - If any defined strand is absent: the level is determined by the count of present strands as
290
+ defined in Section 8.
291
+
292
+ Extended strands MUST NOT change the Authenticity Level taxonomy. They extend the definition of
293
+ "all strands present" but do not add new levels.
294
+
295
+ ---
296
+
297
+ ## 7. The Four Signals
298
+
299
+ ### 7.1 STATE
300
+
301
+ **Method:** GET
302
+ **Path:** `/api/v2/pramana/state[/:entityId]`
303
+
304
+ The STATE signal declares what the system knows and is capable of. Any external system, agent,
305
+ or capability registry may query STATE to discover the capabilities of this system without reading
306
+ its source code or documentation.
307
+
308
+ **Minimum required fields in STATE response:**
309
+
310
+ ```json
311
+ {
312
+ "service": "string",
313
+ "version": "string",
314
+ "status": "online | degraded | offline",
315
+ "can_answer": ["query-slug-1", "query-slug-2"],
316
+ "can_do": ["ACTION_ONE", "ACTION_TWO"],
317
+ "strands_supported": ["capability", "knowledge", "proof"],
318
+ "pramana_version": "1.0"
319
+ }
320
+ ```
321
+
322
+ **Notes:**
323
+ - `can_answer` is the READ surface. Each slug corresponds to a query type in the Query Registry.
324
+ - `can_do` is the WRITE surface. Each item corresponds to an action the system can execute.
325
+ - `strands_supported` lists the strands this system checks at query time.
326
+ - STATE is a public endpoint. It does not require authentication.
327
+
328
+ ### 7.2 TRUST
329
+
330
+ **Method:** GET
331
+ **Path:** `/api/v2/pramana/trust/:userId`
332
+
333
+ The TRUST signal declares what a specific user, role, or agent is authorised to do in this
334
+ system. TRUST replaces custom RBAC middleware.
335
+
336
+ **Minimum required fields in TRUST response:**
337
+
338
+ ```json
339
+ {
340
+ "user_id": "string",
341
+ "role": "string",
342
+ "trust_mask": 0,
343
+ "can_query": ["query-slug-1"],
344
+ "can_execute": ["ACTION_ONE"],
345
+ "authenticity_level_floor": 1
346
+ }
347
+ ```
348
+
349
+ **Notes:**
350
+ - `trust_mask` is a 32-bit integer encoding permissions as a bitmask. See the ankr-trust-constants
351
+ package for the canonical bit allocation.
352
+ - `authenticity_level_floor` is the minimum Authenticity Level this user is permitted to receive.
353
+ If a query would produce an output below this floor, the system returns PRAMANA-0 with
354
+ disclosure rather than delivering the output. Default: 0 (no floor — deliver all outputs with
355
+ appropriate annotation).
356
+
357
+ ### 7.3 SENSE
358
+
359
+ **Method:** POST
360
+ **Path:** `/api/v2/pramana/sense/emit`
361
+
362
+ The SENSE signal is a system-level event emitted at defined points in the query lifecycle. SENSE
363
+ replaces custom notification pipelines. Subscribers receive SENSE events and may react without
364
+ polling.
365
+
366
+ **Minimum required fields in SENSE payload:**
367
+
368
+ ```json
369
+ {
370
+ "event_type": "string",
371
+ "service": "string",
372
+ "timestamp": "ISO-8601",
373
+ "payload": {}
374
+ }
375
+ ```
376
+
377
+ **Standard SENSE event types defined by this specification:**
378
+
379
+ | Event Type | When emitted |
380
+ |---|---|
381
+ | `query.received` | When a query is received by the system |
382
+ | `query.answered` | When an output is delivered, with Authenticity Level |
383
+ | `phala.generated` | When a PHALA signal is generated for a delivery outcome |
384
+ | `rca.triggered` | When an RCA work item is opened |
385
+ | `rca.closed` | When an RCA work item is closed with a Siddhanta |
386
+ | `slm.training_pair_captured` | When a Siddhanta is captured as a training pair |
387
+ | `slm.finetuning_triggered` | When a fine-tuning run is initiated |
388
+
389
+ ### 7.4 PHALA
390
+
391
+ **Method:** POST
392
+ **Path:** `/api/v2/pramana/phala`
393
+
394
+ PHALA is the novel fourth signal. It carries a delivery outcome from the point of delivery back
395
+ to the specific knowledge rules that generated the AI response. PHALA is the mechanism by which
396
+ the protocol closes the feedback loop at rule granularity.
397
+
398
+ #### 7.4.1 PHALA Payload Schema
399
+
400
+ ```json
401
+ {
402
+ "signal_type": "phala",
403
+ "rule_id": "MAR-YK-007",
404
+ "applied_by": "mari8x-legal",
405
+ "query_context": "charter party clause, English law",
406
+ "outcome": "failure",
407
+ "strands_available": ["capability", "knowledge"],
408
+ "strand_missing": ["proof"],
409
+ "authenticity_level": "PRAMANA-2",
410
+ "rca_triggered": true,
411
+ "timestamp": "2026-03-28T14:23:00Z"
412
+ }
413
+ ```
414
+
415
+ **Field definitions:**
416
+
417
+ | Field | Type | Required | Description |
418
+ |---|---|---|---|
419
+ | `signal_type` | string | MUST | Always `"phala"` |
420
+ | `rule_id` | string | MUST | The Rule ID of the rule that generated the response. If multiple rules contributed, emit one PHALA per rule or use `rule_ids` (array variant). |
421
+ | `rule_ids` | string[] | MAY | Array of Rule IDs when multiple rules contributed to a single response. |
422
+ | `applied_by` | string | MUST | The service or agent that applied the rule. |
423
+ | `query_context` | string | SHOULD | Human-readable description of the query context for RCA readability. |
424
+ | `outcome` | enum | MUST | One of: `"success"`, `"failure"`, `"partial"`, `"indeterminate"` |
425
+ | `strands_available` | string[] | MUST | Strand Type IDs that were available at query time. |
426
+ | `strand_missing` | string[] | SHOULD | Strand Type IDs that were absent. SHOULD be present when `outcome` is `"failure"` or `"partial"`. |
427
+ | `authenticity_level` | string | MUST | The Authenticity Level assigned at query time. |
428
+ | `rca_triggered` | boolean | MUST | Whether this PHALA signal has triggered an RCA work item. |
429
+ | `two_wrong_flag` | boolean | MAY | Present and `true` when a Two-Wrong-Equals-Right condition is detected for this output. |
430
+ | `timestamp` | string | MUST | ISO-8601 timestamp of the delivery outcome event. |
431
+ | `session_id` | string | MAY | Opaque session identifier for correlating multiple PHALA signals from a single user session. |
432
+ | `batch_id` | string | MAY | Opaque batch identifier when PHALA signals have been batched (see Section 7.4.3). |
433
+
434
+ #### 7.4.2 PHALA Routing
435
+
436
+ PHALA MUST be routed to the Rule-Level Outcome Registry keyed by `rule_id`, not to the
437
+ responding service's log and not to a centralised system log.
438
+
439
+ The Rule-Level Outcome Registry is a persistent store. The implementing system is responsible
440
+ for its durability. Loss of PHALA signals silently degrades the quality of the RCA trigger
441
+ mechanism.
442
+
443
+ Upon receipt of a PHALA signal, the Rule-Level Outcome Registry MUST:
444
+
445
+ 1. Increment the total PHALA count for the Rule ID.
446
+ 2. Increment the outcome-specific counter (success/failure/partial/indeterminate).
447
+ 3. Update the consecutive-failure counter: increment on `"failure"`, reset on any other outcome.
448
+ 4. Recompute the running confidence score as: `success_count / total_count`.
449
+ 5. Check whether the consecutive-failure counter exceeds the RCA trigger threshold.
450
+
451
+ The RCA trigger threshold is configurable. The default in the reference implementation is 3
452
+ consecutive failures.
453
+
454
+ Implementing systems MAY maintain PHALA history as an append-only log per Rule ID, enabling
455
+ time-series analysis of rule confidence over time.
456
+
457
+ #### 7.4.3 PHALA Aggregation
458
+
459
+ When multiple PHALA signals for the same Rule ID arrive within a configurable time window
460
+ (default: 24 hours), the implementing system MAY batch them into an aggregate PHALA signal
461
+ before checking the RCA trigger threshold.
462
+
463
+ The purpose of batching is to suppress RCA triggers from isolated incidents (single users, edge
464
+ cases, transient connectivity issues) while preserving the signal from systematic rule failures
465
+ that affect multiple users over time.
466
+
467
+ Batch behaviour is optional. A system that emits one PHALA per delivery outcome without batching
468
+ is conformant. Batching is a quality-of-life optimisation, not a correctness requirement.
469
+
470
+ When batching is active, the `batch_id` field in the PHALA payload MUST be populated with an
471
+ opaque identifier shared by all signals in the batch. This allows RCA work items to reference
472
+ the batch rather than individual signals.
473
+
474
+ ---
475
+
476
+ ## 8. Authenticity Markers
477
+
478
+ Every AI system output in a PRAMANA/1.0 implementation MUST carry an Authenticity Level as a
479
+ structured annotation. The annotation MUST be machine-readable. The annotation SHOULD also be
480
+ human-readable in the user-facing rendering.
481
+
482
+ A missing Authenticity Level MUST be treated as PRAMANA-0 by any consuming system.
483
+
484
+ ### 8.1 PRAMANA-0 — UNVERIFIED
485
+
486
+ **Condition:** No strands are available at query time.
487
+
488
+ **Mandatory annotation content:**
489
+ - Level identifier: `"PRAMANA-0"`
490
+ - Human-readable disclosure: This output has not been validated through any independent
491
+ verification process. Do not act on this output without independent expert review.
492
+ - `human_review_required: true`
493
+
494
+ **Display guidance:** Implement a visually distinct flag (e.g., a warning colour) in any
495
+ user-facing rendering. The output may be displayed, but the human review flag must be prominent.
496
+
497
+ ### 8.2 PRAMANA-1 — SINGLE SOURCE
498
+
499
+ **Condition:** Exactly one strand is available.
500
+
501
+ **Mandatory annotation content:**
502
+ - Level identifier: `"PRAMANA-1"`
503
+ - `strand_present`: the Strand Type ID of the available strand.
504
+ - Human-readable disclosure stating which strand is present.
505
+ - Human-readable explanation of why the system answered despite the absence of the other strands.
506
+ Example: "This system's capability to answer this query type has been confirmed (Strand 1 —
507
+ Capability), but the knowledge source used has not been independently indexed (Strand 2 —
508
+ Knowledge absent), and this system has not been independently verified to behave as specified
509
+ (Strand 3 — Proof absent). Use this output for reference only."
510
+
511
+ ### 8.3 PRAMANA-2 — PARTIAL AUTHENTIC
512
+
513
+ **Condition:** Exactly two strands are available.
514
+
515
+ **Mandatory annotation content:**
516
+ - Level identifier: `"PRAMANA-2"`
517
+ - `strands_present`: array of Strand Type IDs of available strands.
518
+ - `strand_missing`: Strand Type ID of the absent strand.
519
+ - Human-readable disclosure naming the absent strand and its implication.
520
+ Example: "This output is produced by a system confirmed as capable (Strand 1) using verified
521
+ knowledge (Strand 2), but has not been independently verified to behave as specified
522
+ (Strand 3 — Proof absent). Suitable for professional use with awareness of this gap."
523
+
524
+ ### 8.4 PRAMANA-3 — AUTHENTIC
525
+
526
+ **Condition:** All defined strands are available. No SLM Plugin active.
527
+
528
+ **Mandatory annotation content:**
529
+ - Level identifier: `"PRAMANA-3"`
530
+ - `strands_present`: array of all Strand Type IDs.
531
+ - Human-readable confirmation.
532
+
533
+ No mandatory disclosure is required at PRAMANA-3 beyond the level identifier. Implementing
534
+ systems MAY include additional strand details for auditability.
535
+
536
+ ### 8.5 PRAMANA-3+ — AUTHENTICATED AND INFERRED
537
+
538
+ **Condition:** All defined strands are available AND an SLM Plugin has contributed domain
539
+ inference to the response.
540
+
541
+ **Mandatory annotation content:**
542
+ - Level identifier: `"PRAMANA-3+"`
543
+ - `strands_present`: array of all Strand Type IDs.
544
+ - `slm_plugin_id`: identifier of the SLM Plugin that contributed to the response.
545
+ - `slm_rules_applied`: array of Rule IDs for which the SLM Plugin fired inference.
546
+ - Human-readable note that SLM inference was applied and the Rule IDs involved.
547
+
548
+ PRAMANA-3+ is not a higher-confidence level than PRAMANA-3 — it is an informational variant.
549
+ The SLM Plugin's presence indicates that the output incorporates domain inference beyond the
550
+ base rules, which may increase specificity but also introduces SLM uncertainty. The annotation
551
+ does not claim that SLM inference improves accuracy.
552
+
553
+ ---
554
+
555
+ ## 9. The Recursive Mini-Loop
556
+
557
+ The protocol is structured around a recursive mini-loop that operates at every stage of the
558
+ delivery pipeline:
559
+
560
+ ```
561
+ READ — check state before acting
562
+ ROUTE — send to the correct destination (strand check, rule lookup, PHALA routing)
563
+ RECORD — log the outcome for the next stage
564
+ ```
565
+
566
+ This loop is not a metaphor. Every implementing system MUST be able to answer:
567
+
568
+ - At query time: READ (what is the STATE?), ROUTE (which strands are available?), RECORD (assign
569
+ Authenticity Level, record Rule IDs).
570
+ - At delivery: READ (what Authenticity Level was assigned?), ROUTE (deliver with annotation),
571
+ RECORD (emit SENSE, await outcome signal).
572
+ - At outcome: READ (what Rule IDs contributed?), ROUTE (PHALA to Rule-Level Outcome Registry),
573
+ RECORD (update counters, check RCA threshold).
574
+ - At RCA: READ (what does the Rule-Level Outcome Registry show?), ROUTE (to human reviewer,
575
+ optional SLM Plugin), RECORD (Siddhanta, training pair).
576
+
577
+ A system that skips any stage of the mini-loop has broken the feedback chain. PHALA signals
578
+ that never reach the Rule-Level Outcome Registry make the RCA trigger inoperable. Authenticity
579
+ Levels that are not recorded against the query make PHALA aggregation incomplete.
580
+
581
+ ---
582
+
583
+ ## 10. The RCA Loop
584
+
585
+ ### 10.1 Failure Classification
586
+
587
+ When an RCA work item is opened for a Rule ID, the human reviewer MUST classify the failure into
588
+ one of three categories:
589
+
590
+ **Category A — Routing Failure:** The query was routed to the wrong service or the wrong rule.
591
+ The rule itself is correct. Corrective action: fix the routing logic or query intent resolution.
592
+
593
+ **Category B — Application Failure:** The rule was applied to the wrong context or with incorrect
594
+ parameters. The rule itself is correct. Corrective action: fix the rule application logic or the
595
+ context extraction.
596
+
597
+ **Category C — Rule Failure:** The rule itself is incorrect, outdated, incomplete, or ambiguous.
598
+ Corrective action: update, replace, or clarify the rule in the Rule Registry.
599
+
600
+ The failure category MUST be recorded in the RCA work item. It is the primary driver of
601
+ corrective action and of the SLM training signal (see Section 10.3).
602
+
603
+ Implementers MAY define sub-categories within each category. The three top-level categories are
604
+ mandatory and MUST NOT be collapsed.
605
+
606
+ ### 10.2 Human in Loop
607
+
608
+ The RCA loop requires human judgment at the classification and Siddhanta stages. This is not
609
+ optional and cannot be automated.
610
+
611
+ The reason is structural: the PRAMANA protocol exists because AI systems cannot reliably
612
+ distinguish between what they know and what they merely compute. Delegating RCA classification
613
+ to the same class of system that produced the failure is circular. The human reviewer is the
614
+ only party in the loop who can make the epistemological determination that the rule is wrong, or
615
+ that the routing was wrong, or that the application was wrong — and who can bear responsibility
616
+ for that determination.
617
+
618
+ Implementing systems MUST NOT design RCA workflows that bypass human review for any failure
619
+ category. Automated pre-classification (e.g., SLM Purva-paksha) is permitted as an input to
620
+ human judgment but MUST NOT replace it.
621
+
622
+ ### 10.3 SLM Plugin Interface
623
+
624
+ The SLM Plugin is an optional component of the PRAMANA RCA loop. When an RCA work item is
625
+ opened, the implementing system MAY invoke the SLM Plugin interface.
626
+
627
+ **SLM Plugin Interface — Request:**
628
+
629
+ ```json
630
+ {
631
+ "plugin_interface": "pramana/slm-plugin/1.0",
632
+ "rule_id": "MAR-YK-007",
633
+ "rule_content": "string — full text of the rule",
634
+ "original_query": "string",
635
+ "original_response": "string",
636
+ "phala_signals": [
637
+ {
638
+ "outcome": "failure",
639
+ "query_context": "string",
640
+ "timestamp": "ISO-8601"
641
+ }
642
+ ],
643
+ "failure_category_hint": "A | B | C | unknown"
644
+ }
645
+ ```
646
+
647
+ **SLM Plugin Interface — Purva-paksha Response:**
648
+
649
+ ```json
650
+ {
651
+ "plugin_interface": "pramana/slm-plugin/1.0",
652
+ "rule_id": "MAR-YK-007",
653
+ "purva_paksha": {
654
+ "failure_category": "C",
655
+ "hypothesis": "string — SLM's inference about the cause of failure",
656
+ "proposed_correction": "string — SLM's proposed corrected rule text or logic",
657
+ "confidence": 0.0
658
+ }
659
+ }
660
+ ```
661
+
662
+ The `confidence` field in the Purva-paksha is the SLM's own confidence in its hypothesis. It
663
+ is presented to the human reviewer as context. It does not gate the human review or constrain
664
+ the Siddhanta.
665
+
666
+ ### 10.4 Training Signal Capture
667
+
668
+ When the human reviewer closes the RCA work item with a Siddhanta, the implementing system MUST
669
+ automatically construct a training pair:
670
+
671
+ **Training Pair Schema:**
672
+
673
+ ```json
674
+ {
675
+ "training_pair_id": "uuid",
676
+ "rule_id": "MAR-YK-007",
677
+ "input": {
678
+ "query": "string",
679
+ "original_response": "string",
680
+ "phala_signals": [],
681
+ "purva_paksha": {}
682
+ },
683
+ "label": {
684
+ "failure_category": "C",
685
+ "siddhanta": "string — human-validated correction",
686
+ "corrected_rule": "string — updated rule text if applicable"
687
+ },
688
+ "captured_by": "string — reviewer identifier",
689
+ "captured_at": "ISO-8601"
690
+ }
691
+ ```
692
+
693
+ The `purva_paksha` field in the input is present only if an SLM Plugin was active. Its inclusion
694
+ allows the fine-tuning run to learn from cases where the SLM's hypothesis was validated by the
695
+ human (reinforcement) as well as cases where it was corrected (correction signal).
696
+
697
+ Training pairs are appended to the SLM's fine-tuning queue. The implementing system MUST
698
+ preserve training pairs durably. Loss of training pairs degrades the self-improvement loop.
699
+
700
+ Fine-tuning triggering, batch sizing, and model versioning are implementation-defined. The
701
+ reference implementation uses a batch size of 50 pairs and triggers fine-tuning automatically.
702
+
703
+ ---
704
+
705
+ ## 11. Minimum Viable Implementation
706
+
707
+ A system claiming PRAMANA/1.0 compatibility MUST implement ALL of the following:
708
+
709
+ 1. **STATE endpoint** at a declared path returning at minimum: `service`, `version`, `status`,
710
+ `can_answer`, `strands_supported`, `pramana_version`.
711
+
712
+ 2. **TRUST endpoint** at a declared path returning at minimum: `user_id`, `role`, `trust_mask`.
713
+
714
+ 3. **At least one Strand** checked at query time, with binary result.
715
+
716
+ 4. **Authenticity Level assignment** for every output, based on strand availability.
717
+
718
+ 5. **PRAMANA annotation** attached to every output, machine-readable, including
719
+ `authenticity_level` and mandatory disclosures per Section 8.
720
+
721
+ 6. **Rule ID recording** — for every query, one or more Rule IDs contributing to the response
722
+ MUST be recorded and associated with the output.
723
+
724
+ 7. **PHALA signal generation** on delivery outcome, routed to a Rule-Level Outcome Registry
725
+ keyed by Rule ID.
726
+
727
+ 8. **Rule-Level Outcome Registry** maintaining per-Rule-ID counters (success, failure, total,
728
+ consecutive-failure).
729
+
730
+ 9. **RCA trigger** when consecutive-failure counter exceeds threshold.
731
+
732
+ 10. **Human-reviewable RCA work item** with failure classification.
733
+
734
+ A system implementing fewer than all ten requirements is not PRAMANA/1.0 compatible. It MAY
735
+ describe itself as a partial implementation and SHOULD specify which requirements it satisfies.
736
+
737
+ ---
738
+
739
+ ## 12. Full Implementation
740
+
741
+ A full PRAMANA/1.0 implementation additionally provides:
742
+
743
+ 1. **All three strands** (Capability, Knowledge, Proof) checked at query time.
744
+ 2. **SENSE endpoint** with standard event types as defined in Section 7.3.
745
+ 3. **PHALA batching** (Section 7.4.3).
746
+ 4. **Two-Wrong-Equals-Right detection** (per provisional patent claim 4 in the PHALA Signal
747
+ patent application): `two_wrong_flag` populated in PHALA when detected.
748
+ 5. **SLM Plugin interface** (Section 10.3), including Purva-paksha/Siddhanta cycle.
749
+ 6. **Training pair capture and fine-tuning queue** (Section 10.4).
750
+ 7. **PRAMANA-3+** annotation support.
751
+ 8. **Query Registry** with per-query-type minimum expected Authenticity Level.
752
+ 9. **Session-level PHALA correlation** via `session_id`.
753
+ 10. **SENSE subscriptions** — downstream systems can subscribe to SENSE events without polling.
754
+
755
+ The reference implementation (ANKR) provides all ten full implementation components. See
756
+ Section 16 for reference implementation details.
757
+
758
+ ---
759
+
760
+ ## 13. Interoperability
761
+
762
+ When two PRAMANA-compatible organisations exchange AI knowledge queries across a network
763
+ boundary, the following rules apply:
764
+
765
+ **13.1 Strand portability.** Strands checked by the sending organisation are NOT automatically
766
+ inherited by the receiving organisation. Each organisation checks its own strands at its own
767
+ query boundary. An output that arrives at PRAMANA-3 from Organisation A may be PRAMANA-1 at
768
+ Organisation B if B has only one strand defined for its system.
769
+
770
+ **13.2 PHALA forwarding.** An organisation that proxies a query to another PRAMANA-compatible
771
+ system SHOULD forward PHALA signals received from the proxied system to its own Rule-Level
772
+ Outcome Registry, translated to its own Rule ID namespace where applicable. If translation is
773
+ not possible, PHALA signals SHOULD be logged for manual review.
774
+
775
+ **13.3 Authenticity Level propagation.** When an output from Organisation A is incorporated
776
+ into a composite output by Organisation B, Organisation B MUST annotate the composite output
777
+ with the minimum Authenticity Level across all component outputs. Minimum propagation is
778
+ mandatory. Averaging Authenticity Levels is prohibited.
779
+
780
+ **13.4 Strand Type Registry.** Organisations wishing to define shared strands that can be
781
+ mutually recognised SHOULD register their Strand Type IDs in the PRAMANA Strand Type Registry
782
+ (see Section 15). Unregistered strand types may be used internally but MUST be prefixed with
783
+ `x-` to indicate non-standard status.
784
+
785
+ **13.5 STATE discovery.** A PRAMANA-compatible system MUST expose its STATE endpoint at a
786
+ publicly resolvable URL for interoperability with external capability registries.
787
+
788
+ ---
789
+
790
+ ## 14. Security Considerations
791
+
792
+ **14.1 Authenticity Level forgery.** An adversarial system could claim PRAMANA-3 for outputs
793
+ generated without any strand verification. Consuming systems SHOULD verify Authenticity Level
794
+ claims by querying the producing system's STATE endpoint and cross-checking declared
795
+ `strands_supported` against the claimed level. Claims inconsistent with declared strand support
796
+ MUST be downgraded to PRAMANA-0 by the consuming system.
797
+
798
+ **14.2 PHALA signal injection.** A malicious actor could inject false PHALA signals to trigger
799
+ spurious RCA events for a Rule ID, degrading the quality of the feedback loop or forcing
800
+ unnecessary fine-tuning. Implementing systems MUST authenticate PHALA signal sources. Only
801
+ delivery systems and authorised downstream systems SHOULD be permitted to emit PHALA signals for
802
+ a given Rule ID.
803
+
804
+ **14.3 Rule Registry integrity.** Rule IDs are the primary routing key for PHALA signals and the
805
+ primary label in SLM training pairs. Corruption of the Rule Registry — including unauthorised
806
+ addition, modification, or deletion of rules — directly corrupts the feedback loop and the SLM
807
+ training signal. Rule Registries MUST be access-controlled and append-only for modifications
808
+ (updates must be versioned, not destructive).
809
+
810
+ **14.4 SLM Plugin isolation.** The SLM Plugin receives query contexts and full rule text. These
811
+ may contain sensitive domain data. Implementing systems MUST apply the same access controls to
812
+ the SLM Plugin interface as to the query processing pipeline. SLM Plugins MUST NOT be permitted
813
+ to modify Rule Registry entries directly — corrections flow via the Siddhanta capture path, not
814
+ direct write.
815
+
816
+ **14.5 Human reviewer authentication.** RCA work items generate training data. The identity of
817
+ the human reviewer who validates a Siddhanta MUST be recorded in the training pair
818
+ (`captured_by` field). Implementing systems MUST authenticate human reviewers before they can
819
+ close RCA work items. Unauthenticated Siddhanta submissions MUST be rejected.
820
+
821
+ **14.6 Authenticity Level floor enforcement.** The `authenticity_level_floor` field in the TRUST
822
+ response (Section 7.2) is a policy control that prevents low-authenticity outputs from reaching
823
+ users who require higher assurance. Implementing systems MUST enforce this floor server-side,
824
+ not rely on client-side enforcement.
825
+
826
+ ---
827
+
828
+ ## 15. IANA / Registry Considerations
829
+
830
+ This specification defines a Strand Type Registry for PRAMANA/1.0. The registry maps Strand Type
831
+ IDs to definitions.
832
+
833
+ **Initial registered strand types:**
834
+
835
+ | Strand Type ID | Name | Defined by |
836
+ |---|---|---|
837
+ | `capability` | Capability Strand | PRAMANA/1.0 (this specification) |
838
+ | `knowledge` | Knowledge Strand | PRAMANA/1.0 (this specification) |
839
+ | `proof` | Proof/Conformance Strand | PRAMANA/1.0 (this specification) |
840
+
841
+ **Registration procedure:**
842
+ Organisations wishing to register additional strand types SHOULD submit a registration request
843
+ to the PRAMANA Strand Type Registry at the reference implementation repository
844
+ (https://github.com/rocketlang/forja-protocol). A registration request MUST include: Strand
845
+ Type ID (globally unique, no `x-` prefix), Strand Name, How to check (machine-readable
846
+ description of the binary availability check), Absence implication, and Contact information.
847
+
848
+ **Non-standard strand types:**
849
+ Organisations implementing non-standard strands for internal use MUST prefix their Strand Type ID
850
+ with `x-` (e.g., `x-regulatory-approval`). Non-standard types MUST NOT be used in
851
+ interoperability scenarios without prior bilateral agreement.
852
+
853
+ **Authenticity Level namespace:**
854
+ The five Authenticity Levels defined in Section 8 (PRAMANA-0 through PRAMANA-3+) are reserved.
855
+ No implementer may define additional levels within this namespace. Extended strands modify the
856
+ definition of "all strands present" but do not add levels.
857
+
858
+ ---
859
+
860
+ ## 16. Reference Implementation — ANKR
861
+
862
+ The ANKR reference implementation is maintained by PowerPbox IT Solutions Pvt Ltd.
863
+
864
+ **Repository:** https://github.com/rocketlang/forja-protocol
865
+
866
+ **npm packages:**
867
+ - `ankr-forja` — AnkrForja STATE/TRUST/SENSE/PHALA primitives (version 0.2.2+)
868
+ - `ankr-trust-constants` — bitmask constants and strand type registry (version 1.0.2+)
869
+
870
+ **Reference implementation services:**
871
+ - **AnkrForja** — implements all four signals (STATE, TRUST, SENSE, PHALA). Used by 205+
872
+ ANKR services.
873
+ - **AnkrCodex** — Capability Strand registry. Crawls all Forja STATE endpoints across the ANKR
874
+ universe. Provides Strand 1 availability checks.
875
+ - **GRANTHX** — Knowledge Strand registry. Indexes LOGICS documents in `.ib` format. Provides
876
+ Strand 2 availability checks.
877
+ - **AnkrClaw CCA** — Proof Strand registry. Runs Capability Closure Audits. Provides Strand 3
878
+ availability checks.
879
+
880
+ **The 32-bit Trust Bitmask:**
881
+ The ANKR reference implementation encodes service capabilities as a 32-bit integer per service:
882
+ - Bits 0–7: Universal Forja (READ, QUERY, WRITE, EXECUTE, APPROVE, AUDIT, ADMIN, SUPER)
883
+ - Bits 8–15: Maritime 8x block
884
+ - Bits 16–23: Logistics block
885
+ - Bits 24–31: AGI autonomy tier
886
+
887
+ This encoding allows AnkrCodex to answer "which of 200+ services can perform a given capability"
888
+ via a single bitmask AND operation across 200 rows — sub-millisecond, zero interpretation,
889
+ zero hallucination possible.
890
+
891
+ ---
892
+
893
+ ## 17. Authors
894
+
895
+ ```
896
+ Capt. Anil Kumar Sharma
897
+ Founder, PowerPbox IT Solutions Pvt Ltd
898
+ DPIIT Registered Startup, Haryana, India
899
+ capt.anil.sharma@powerpbox.org
900
+ +91-7506926394
901
+
902
+ The ANKR system described in this document represents the output of a solo founder building
903
+ with AI as co-author. Every protocol, architecture decision, and naming convention in this
904
+ document was conceived and validated under conditions that have no precedent in institutional
905
+ engineering. The Nalanda epistemological framework was not adopted as branding — it was
906
+ recognised as the exact framework that the problem required.
907
+
908
+ धर्मकीर्ति's Pramana ends at valid inference. So does this protocol.
909
+ The 15% that remains human — moral judgment, creative originality, contextual wisdom —
910
+ cannot be delegated to a machine. Not now. Not in any protocol version.
911
+
912
+ Priority date: 2026-03-28
913
+ ```
914
+
915
+ ---
916
+
917
+ *PRAMANA/1.0 — Open Protocol Specification*
918
+ *© 2026 PowerPbox IT Solutions Pvt Ltd. Open protocol. Reference implementation Apache 2.0.*
919
+ *capt.anil.sharma@powerpbox.org | +91-7506926394*