diff --git a/client/debug.html b/client/debug.html
new file mode 100644
index 0000000..0e5e286
--- /dev/null
+++ b/client/debug.html
@@ -0,0 +1,363 @@
+
+
+
+
+
+ Navi — Context Debug
+
+
+
+
+
+
+
+ Enter a session ID to inspect what the model sees.
+
+
+
+
+
+
+
diff --git a/navi/api/routes/sessions.py b/navi/api/routes/sessions.py
index bfd9b45..310e4af 100644
--- a/navi/api/routes/sessions.py
+++ b/navi/api/routes/sessions.py
@@ -95,6 +95,25 @@
return {"session_id": session_id, "pinned": body.pinned}
+@router.get("/{session_id}/context")
+async def get_session_context(
+ session_id: str,
+ store: Annotated[SessionStore, Depends(get_session_store)],
+) -> dict:
+ """Return the LLM context (what the model actually sees) for debugging."""
+ session = await store.get(session_id)
+ if session is None:
+ raise HTTPException(status_code=404, detail="Session not found")
+ total_chars = sum(len(m.content or "") for m in session.context)
+ return {
+ "session_id": session.id,
+ "profile_id": session.profile_id,
+ "message_count": len(session.context),
+ "total_chars": total_chars,
+ "context": [m.model_dump(mode="json", exclude_none=True) for m in session.context],
+ }
+
+
@router.delete("/{session_id}", status_code=204)
async def delete_session(
session_id: str,
diff --git a/navi/main.py b/navi/main.py
index 2749e46..c1c74e7 100644
--- a/navi/main.py
+++ b/navi/main.py
@@ -41,3 +41,8 @@
@app.get("/", include_in_schema=False)
async def index() -> FileResponse:
return FileResponse("client/index.html", headers={"Cache-Control": "no-store"})
+
+
+@app.get("/debug", include_in_schema=False)
+async def debug() -> FileResponse:
+ return FileResponse("client/debug.html", headers={"Cache-Control": "no-store"})