Back to Prompt Library
implementation
Build the application
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: Build a Delegated Data-Access Consent Revocation and Agent Audit Monitor
Format
Code-aware
Lines
91
Sections
11
Linked challenge
Build a Delegated Data-Access Consent Revocation and Agent Audit Monitor
Prompt source
Original prompt text with formatting preserved for inspection.
91 lines
11 sections
No variables
1 code block
## Build
Track data access requests from delegated third-party consumer agents against dynamic user consent registries. Enforce instant revocation signals, verify purpose limitations, and log non-compliant data access attempts for supervisory review.
## User
Data protection compliance officer
## Workflow
1. Capture data query callbacks containing Beckn transaction context identifiers and requested user profile fields.
2. Cross-reference query timestamps against user consent registry status records including active revocations.
3. Flag unauthorized data harvesting attempts where the requested scope exceeds the approved transaction purpose.
4. Generate structured compliance alert records and automated revocation enforcement notifications.
## Interface
Consent audit console displaying active consents, revocation timestamps, data request streams, and policy breaches.
## Data
Create synthetic consent registry entries and corresponding agent API access log streams locally.
Starter examples below are synthetic. They are not downloaded records.
## Source
[Beckn protocol specifications](https://raw.githubusercontent.com/beckn/protocol-specifications/master/README.md)
Utilizes Beckn protocol packet context fields (context.action, context.bap_id, context.timestamp) to audit consent scopes.
## Tools
anthropic-claude, pydantic, pytest.
Claude provides rigorous contextual reasoning over legal data sharing boundaries and structured compliance outputs.
Hosted Claude API for evaluating complex privacy policies and structured audit report creation.
## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.
## Acceptance
- Instantly flags and denies agent data queries submitted after a consent revocation timestamp.
- Detects out-of-scope attribute queries (e.g., requesting full contact book for grocery delivery).
- Emits compliant Beckn NACK response frames citing specific data governance violation codes.
## Starter Examples
```json
[
{
"input": {
"consent_status": {
"consent_id": "c_901",
"user_id": "u_33",
"status": "REVOKED",
"revocation_timestamp": "2025-05-10T14:30:00Z",
"permitted_purposes": [
"delivery_coordination"
]
},
"access_attempt": {
"bap_id": "external-buyer-app.mock",
"timestamp": "2025-05-10T15:00:00Z",
"requested_fields": [
"phone_number",
"delivery_address"
],
"purpose": "delivery_coordination"
}
},
"expected_output": {
"decision": "DENIED",
"violation_code": "CONSENT_REVOKED",
"audit_message": "Access denied because consent c_901 was revoked at 2025-05-10T14:30:00Z.",
"beckn_ack": "NACK"
}
},
{
"input": {
"consent_status": {
"consent_id": "c_902",
"user_id": "u_44",
"status": "ACTIVE",
"revocation_timestamp": null,
"permitted_purposes": [
"delivery_coordination"
]
},
"access_attempt": {
"bap_id": "external-buyer-app.mock",
"timestamp": "2025-05-11T10:00:00Z",
"requested_fields": [
"financial_bank_details",
"pan_card"
],
"purpose": "credit_profiling"
}
},
"expected_output": {
"decision": "DENIED",
"violation_code": "PURPOSE_MISMATCH",
"audit_message": "Purpose 'credit_profiling' and requested financial fields exceed authorized scope 'delivery_coordination'.",
"beckn_ack": "NACK"
}
}
]
```
## Safety
Operates strictly on synthetic consent metadata; no real citizen private information or biometric data is handled.
Use mock external writes. Require human review before any real deployment.Adaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Hold the task contract and output shape stable so generated implementations remain comparable.
Tune next
Update libraries, interfaces, and environment assumptions to match the stack you actually run.
Verify after
Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.