Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Publish Book
name: Publish Docs

on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/pages.yml"
- "docs/book/**"
- "_context/wiki/**"
push:
branches: [main]
paths:
- ".github/workflows/pages.yml"
- "docs/book/**"
- "_context/wiki/**"

permissions:
contents: read
Expand All @@ -27,12 +27,12 @@ jobs:
uses: taiki-e/install-action@v2.75.27
with:
tool: mdbook@0.5.3
- name: Build book
run: mdbook build docs/book
- name: Build docs
run: mdbook build _context/wiki
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: docs/book/book
path: _context/wiki/book

deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ target

# Generated by gateway local runs
contextforge-data-plane.log.*

# Generated by mdBook
docs/book/book/
# Generated by mdBook (wiki)
_context/wiki/book/

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
Expand Down
43 changes: 18 additions & 25 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# AGENTS.md

## Start with the wiki

At the start of each task, check `_context/wiki/index.md` to decide
whether wiki context is needed before acting. Don't read the wiki in
full. Use the index and follow links only when they are relevant to
the task.

## Update the wiki

After completing a task, offer to update the wiki if the task yielded durable knowledge that could benefit future work, then wait for user approval. This includes new processes, architecture decisions, or insights that go beyond the immediate task.

When adding a new wiki page, also update:
- `_context/wiki/index.md` — add a row to the pages table
- `_context/wiki/SUMMARY.md` — add the page under the appropriate section so it appears in the published book

---

Guidance for agents working on `contextforge-data-plane`.

This repo is the Rust dataplane part of ContextForge. It must stay compatible
Expand All @@ -23,30 +40,6 @@ control-plane, UI, IAM, or metrics-storage app.
- Temporary compatibility shims in the current implementation are migration
details, not supported client contracts. Do not build new behavior on them.

## Architecture

Architecture documentation lives in The ContextForge Data Plane Book under
[docs/book](docs/book/README.md). Read the relevant page before changing the
hot path:

| Page | Read it for |
| --- | --- |
| [What is ContextForge Data Plane?](docs/book/src/what-is-contextforge-data-plane.md) | Scope, boundaries, key terms, and the mental model. |
| [System Shape](docs/book/src/system-shape.md) | Crate layout, control-plane boundary, pipeline shape, state ownership, and module boundaries. |
| [Request Flow](docs/book/src/request-flow.md) | Startup, middleware order, initialize fanout, authorized calls, and the response path. |
| [Concurrency And Runtime Model](docs/book/src/concurrency-and-runtime.md) | Executor shapes, shared state and locks, fanout, and cancellation. |
| [Authentication And User Config Lookup](docs/book/src/authentication-and-user-config.md) | JWT validation, config keying, cache behavior, and failure responses. |
| [Security Model And Trust Boundaries](docs/book/src/security-model.md) | Trust boundaries, compromise impact, and transport security posture. |
| [Runtime Configuration](docs/book/src/runtime-configuration.md) | The `UserConfig` model, Redis/MessagePack persistence, and plugin runtime config. |
| [Control-Plane Integration](docs/book/src/control-plane-integration.md) | Redis keys, schemas, token shape, and route parity with the control plane. |
| [Backend Connections And Transports](docs/book/src/backend-connections-and-transports.md) | Downstream, upstream, and config-store transports plus TLS direction. |
| [Session Ownership](docs/book/src/session-ownership.md) | Backend session state, cleanup, and load-balancing constraints. |
| [MCP Routing Semantics](docs/book/src/mcp-routing-semantics.md) | The backend prefix namespace and routing contract. |
| [Architectural Choices](docs/book/src/architectural-choices.md) | Invariants and tradeoffs that must not change accidentally. |

The book is rendered from `docs/book/src/` and published through GitHub Pages;
see [docs/book/README.md](docs/book/README.md) for build and validation steps.

## Working Rules

- Most product behavior belongs in `contextforge-data-plane-lib`; avoid adding
Expand All @@ -57,7 +50,7 @@ see [docs/book/README.md](docs/book/README.md) for build and validation steps.
logic, split logic, and tests.
- This project is still early development with no external users; prefer the
right architecture over preserving unstable APIs or compatibility surfaces.
- When behavior on the hot path changes, update the matching book page in the
- When behavior on the hot path changes, update the matching wiki page in the
same change.

## Logging
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
.PHONY: help docker-prod testing-up testing-down
.PHONY: help docker-prod compose-up compose-down docs-serve

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'

docker-prod: ## Build production Docker image (contextforge-data-plane:latest) from docker/Dockerfile
docker build -t contextforge-data-plane:latest -f docker/Dockerfile .

testing-up: ## Launch testing stack: nginx, control plane, redis, postgres, pgbouncer, dataplane, fast_time_server
compose-up: ## Launch stack: nginx, control plane, redis, postgres, pgbouncer, dataplane, fast_time_server
@docker image inspect contextforge-data-plane:latest >/dev/null 2>&1 || { \
echo "Image contextforge-data-plane:latest not found. Run 'make docker-prod' first."; \
exit 1; \
}
docker compose -f docker/docker-compose.yml up -d nginx control-plane redis postgres pgbouncer data-plane fast_time_server register_fast_time

testing-down: ## Tear down the testing stack
compose-down: ## Tear down the stack
docker compose -f docker/docker-compose.yml stop nginx control-plane redis postgres pgbouncer data-plane fast_time_server register_fast_time

docs-serve: ## Serve the wiki book locally at http://127.0.0.1:3000
mdbook serve _context/wiki --hostname 127.0.0.1 --port 3000 --open
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ The Rust data plane for
traffic, loads control-plane-published configuration from Redis, and routes
authorized requests to configured MCP backends.

Architecture, configuration, operations, and development documentation lives
in [The ContextForge Data Plane Book](docs/book/src/SUMMARY.md). Build it locally
with `mdbook serve docs/book`; see [docs/book/README.md](docs/book/README.md).
Architecture, configuration, operations, and development context lives
in the wiki under [`_context/wiki/`](_context/wiki/index.md).

## Quick Start

Expand All @@ -16,16 +15,16 @@ test stack:

```bash
make docker-prod
make testing-up
make compose-up
```

The stack uses the current `fast_time_server` backend and exercises config
publication through the external ContextForge control plane. Follow
[Local Docker Stack](docs/book/src/local-docker-stack.md) for the complete smoke
publication through the external ContextForge control plane. See
[getting-started.md](_context/wiki/getting-started.md) for the complete smoke
test, then stop it with:

```bash
make testing-down
make compose-down
```

## Run the Binary from Cargo
Expand All @@ -38,13 +37,13 @@ docker compose -f docker/docker-compose-local.yaml up -d
docker compose -f docker/docker-compose-local.yaml ps redis gateway-one gateway-two
```

Then follow [Run the Gateway Locally](docs/book/src/running-the-gateway.md).
Then follow [getting-started.md](_context/wiki/getting-started.md) for the local cargo dev workflow.

## Runtime CPEX Plugins

Runtime CPEX plugins are disabled by default. When enabled, the data plane loads
validated plugin configuration from Redis and supports the narrow hook surface
documented in [Plugins And Policy](docs/book/src/plugins-and-policy.md).
documented in [config.md](_context/wiki/config.md).

The optional demo plugin crates still come from their independently hosted
`cpex-plugins-rs` repository; they are unrelated to the retired MCP SDK fork.
Expand Down Expand Up @@ -83,9 +82,7 @@ cargo run --release \

## Tracing and Metrics

The data plane exports OTLP traces and metrics. The local Langfuse,
OpenTelemetry Collector, and Prometheus overlays are documented in
[Telemetry And Diagnostics](docs/book/src/telemetry-and-diagnostics.md).
The data plane exports OTLP traces and metrics. Local Langfuse, OTel Collector, and Prometheus overlays are documented in [config.md](_context/wiki/config.md) under "Local Telemetry Verification Stack".

## Performance Tests

Expand Down
25 changes: 25 additions & 0 deletions _context/wiki/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Summary

[Introduction](index.md)

# The Project

- [What is ContextForge Data Plane?](project.md)
- [Getting Started](getting-started.md)

# Architecture

- [Architecture](architecture.md)
- [MCP Routing Semantics](routing.md)
- [Security Model](security.md)
- [Failure Modes](failure-modes.md)

# Operations

- [Configuration Reference](config.md)
- [Deployment](deployment.md)
- [Performance](performance.md)

# Contributing

- [Working Preferences](preferences.md)
Loading
Loading