PCSL (Personal Context Sovereignty Layer) is an open protocol that lets you own your AI context and share it selectively with any AI tool — instead of re-explaining yourself every time.
Without PCSL: Paste your background into every new AI session.
With PCSL: One local server. Every AI tool instantly knows you.
pip install pcsl
pcsl init
pcsl server start
pcsl context showThat's it. Your personal context is now running as a local API at http://localhost:8000. Any AI tool can request scoped access to it.
pcsl context show— view your full contextpcsl context set identity name "Your Name"— update any fieldpcsl context get skills— fetch scope-filtered context via JWT authpcsl token create my-tool identity,skills— mint a scoped token for any apppcsl token revoke my-tool— cut off access instantlypcsl audit— see exactly who accessed what and when
| Command | Description |
|---|---|
pcsl init |
Bootstrap ~/.pcsl/ — creates context.json + generates SECRET_KEY |
pcsl server start |
Start local API server on port 8000 (detached) |
pcsl server stop |
Stop the server |
pcsl server status |
Show PID, URL, version |
pcsl context show |
Pretty-print your full context.json |
pcsl context set <ns> <key> <val> |
Update a context field |
pcsl context get <ns> |
Fetch scope-filtered context via API |
pcsl token create <id> <scopes> |
Mint a scoped JWT for an external tool |
pcsl token revoke <id> |
Revoke a client's access |
pcsl audit |
View the full access log as a table |
After pcsl init, edit ~/.pcsl/context.json:
{
"pcsl_version": "1.0",
"identity": {
"name": "Your Name",
"profession": "Your Role",
"location": "City, Country"
},
"preferences": {
"communication_style": "direct, no fluff",
"tone": "professional"
},
"skills": {
"languages": ["Python", "TypeScript"],
"domains": ["RAG systems", "LLM optimization"]
},
"goals": {
"short_term": ["ship X", "learn Y"],
"long_term": ["build Z"]
}
}Any AI tool you authorize gets only the namespaces you explicitly grant.
Any app that speaks HTTP can request your context.
Python (with SDK):
from pcsl_sdk import PCSLClient
pcsl = PCSLClient(server_url="http://localhost:8000")
token = pcsl.authorize(client_id="my-app", scopes=["preferences", "skills"])
context = pcsl.get_context(token)
system_prompt = pcsl.inject_into_prompt(token, "You are a helpful assistant.")Raw HTTP:
# 1. Get a token
TOKEN=$(curl -s -X POST http://localhost:8000/pcsl/authorize \
-H "Content-Type: application/json" \
-d '{"client_id":"curl-test","scopes":["identity","skills"]}' \
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")
# 2. Fetch your context
curl -H "Authorization: Bearer $TOKEN" http://localhost:8000/pcsl/contextpcsl initcreates~/.pcsl/context.json(your data) and aSECRET_KEY(your auth)pcsl server startruns a local FastAPI server — only accessible on your machine- An AI tool calls
/pcsl/authorizewith aclient_idand requestedscopes - The server returns a short-lived JWT scoped to exactly those namespaces
- The tool fetches
/pcsl/contextwith the JWT — gets only what it asked for - Every access is logged. You can revoke any client at any time.
Your data never leaves your machine unless you choose to expose the server publicly.
By default PCSL runs locally. To make your context available to cloud-based AI tools:
After deploying:
- Set these environment variables in Railway dashboard:
SECRET_KEY— run:python -c "import secrets; print(secrets.token_hex(32))"PCSL_ENCRYPTION_KEY— run:python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"PCSL_SERVER_URL— your Railway URL, e.g.https://your-app.up.railway.app
- Add a Volume in Railway, mount at
/app/pcsl/pcsl_server/dataso your context persists across redeploys - Edit your context via
POST /pcsl/updateor by updatingcontext.jsonbefore deploy
git clone https://github.com/CodeForgeNet/opencontext.git
cd pcsl
cp .env.example .env
# Fill in SECRET_KEY and PCSL_ENCRYPTION_KEY in .env
docker-compose up -dPCSL/
├── pcsl/
│ ├── cli.py # CLI entry point (pcsl command)
│ ├── pcsl_server/ # FastAPI server
│ │ ├── main.py # API endpoints
│ │ ├── auth.py # JWT authentication
│ │ └── data/ # User data storage (runtime)
│ ├── chunker.py # Semantic context chunking
│ ├── mcp_server.py # MCP protocol server
│ ├── spec/ # Protocol specification
│ ├── pcsl-sdk-python/ # Python SDK
│ ├── pcsl-sdk-js/ # JavaScript SDK
│ ├── pcsl-extension/ # Browser extension
│ └── examples/ # Integration examples
├── pyproject.toml # Python package configuration
├── docker-compose.yml # Docker deployment
└── LICENSE # Apache 2.0 License
| Endpoint | Method | Description |
|---|---|---|
/.well-known/pcsl.json |
GET | Discovery endpoint |
/pcsl/authorize |
POST | Request scoped access token |
/pcsl/context |
GET | Fetch authorized context |
/pcsl/context/smart |
GET | Semantic context retrieval |
/pcsl/update |
POST | Update context (requires write scope) |
/pcsl/audit |
GET | View access logs |
/pcsl/revoke |
POST | Revoke client access |
Namespaces allow AI apps to request only the specific context they need. When authorizing, the app requests specific scopes—users approve what gets shared.
identity- Basic user information (name, profession, location)preferences- AI interaction preferences (tone, communication style)skills- Technical skills and expertiseprojects- Current/past project detailsgoals- Short and long-term objectivesdecisions- Key decisions and reasoninghealth- Health-related data (sensitive, off by default)finances- Financial context (sensitive, off by default)
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- content.js raw JSON injection: The browser extension currently injects raw JSON blob into textarea elements instead of properly simulating keyboard input. This may cause issues with some AI chat interfaces. Track progress at: https://github.com/CodeForgeNet/opencontext/issues
Licensed under the Apache License 2.0. See LICENSE for details.
Built by Karan Singh. PCSL v1.0 — Own your context.