Practice Memory
README.md
# Practice Memory
Fifty people keep solving the same problems. When someone figures out something hard it stays in
their head or dies in a Teams thread, and six months later someone else hits the same wall and
starts over.
Practice Memory stores those lessons in ServiceNow, one per record, and lets you ask Claude a normal
question. You get an answer that cites the notes it came from and names a person to ask, or a plain
"no note covers this".
> **Scope.** This is a single-user system built to a practice-scale design. One person built it and
> has used it, on one instance, with 33 notes. It has never served a second user or been installed
> on a second instance. See [`docs/limits.md`](docs/limits.md).
> **Personal project.** Built by [Arun Saravanen](https://arunsaravanen.dev). It is not a ServiceNow
> product and is not affiliated with or endorsed by ServiceNow. The project is closed: it is
> published as a finished case study, not as maintained software.
## Why read this
- **You are building on ServiceNow with Fluent.** The scoped app is complete source: tables, roles,
ACLs and a data policy, with the defects that only showed up on the instance written down.
- **You are building an MCP server.** The logic lives in one module that knows nothing about MCP, so
it can be tested and measured without a client.
- **You want to know if an AI answer layer can be trusted.** The eval has 20 trap questions the
system must refuse, graded blind, and the write-up says where the first measurements were wrong.
## What exists
- **A ServiceNow scoped app:** four tables, three roles, 22 ACLs, a data policy, forms and lists, all
in Fluent source under `servicenow/`.
- **A local MCP server:** five tools and one prompt. `practice_memory/core.py` holds the logic and
imports nothing from MCP, and a test enforces that.
- **A two-layer eval:** 45 questions, 20 of them traps the system must refuse.
- **A backup:** `data/corpus.json`, with tools to export and restore it.
Retrieval is facets plus IDF-weighted keyword matching, ranked in Python. There is no vector index,
and [`docs/engineering-narrative.md`](docs/engineering-narrative.md) explains why.

## Does it work
Measured on 33 notes, both layers on 2026-11-12. Every answer-layer verdict was given by a grader that
could not see the mark scheme.
| | Retrieval | Answer layer |
|---|---|---|
| Exact match | 71% | not applicable |
| Recall / precision | 87% / 61% | not applicable |
| **Refuses what it should** | 55% | **95%** |
The two columns differ because retrieval can only match words, while the answer layer reads the notes
and declines when they don't answer the question. A user only ever sees the answer layer. The full
account, including where the measurement was wrong, is in [`docs/results.md`](docs/results.md).
## Try it without ServiceNow
The tests and the linter need no instance and no credentials.
```bash
python3 -m venv .venv && .venv/bin/pip install -r requirements-dev.txt
.venv/bin/python -m pytest -q # 215 pass offline, 6 live tests skip
.venv/bin/ruff check .
```
The server also starts offline (`PM_MODE=fixtures`, the default), but that mode holds a single
note for the test suite. To ask real questions you need the notes in ServiceNow, which is the next
section.
## Run it on your own instance
You need Python 3.14, Node, Claude Code, and admin on a ServiceNow instance. **Steps 3 and 5 onward
have only ever run against the original instance**, so expect to find something this guide missed.
```bash
# 1. Install
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
(cd servicenow && npm ci)
# 2. Use your instance's prefix. It is the system property glide.appcreator.company.code.
.venv/bin/python tools/set_scope.py x_<yourcode>_pmem
# 3. Deploy the app
cd servicenow
npx now-sdk auth --add <your-instance> --type basic --alias pmem
npx now-sdk install
cd ..
```
4. In ServiceNow, create a service account with the roles `x_<yourcode>_pmem.reader` and
`snc_basic_auth_api_access`. Do not give the second role to `admin` (D-28).
5. Copy `.env.example` to `.env`, fill in `SN_INSTANCE`, `SN_MCP_USER` and `SN_MCP_PASSWORD`, and set
`PM_MODE=live`.
6. Load the 20 synthetic notes, then open Claude Code in this folder. `.mcp.json` starts the server.
```bash
.venv/bin/python tools/restore_corpus.py --source seed --apply
```
Try the system with "What have we learned about HR scope?" Capture a note by telling Claude what you
learned. It saves a Draft, and a person publishes it in ServiceNow before it is served.
## Everyday commands
```bash
.venv/bin/python -m pytest -q # tests, live ones skip without credentials
.venv/bin/python tools/export_corpus.py # refresh the backup
.venv/bin/python tools/restore_corpus.py # show what a restore would write
.venv/bin/python tools/run_eval.py # score retrieval
./tools/render_diagram.sh # redraw the architecture diagram
```
## Read next
Start here, in this order:
| # | Document | What you get | Time |
|---|---|---|---|
| 1 | [`docs/worked-example.md`](docs/worked-example.md) | One real capture and one real answer | 5 min |
| 2 | [`docs/architecture.md`](docs/architecture.md) | The system on a whiteboard, then the detail | 2 to 20 min |
| 3 | [`docs/engineering-narrative.md`](docs/engineering-narrative.md) | Decisions, defects and reversals | 15 min |
| 4 | [`docs/results.md`](docs/results.md) | How the numbers were measured | 5 min |
| 5 | [`docs/limits.md`](docs/limits.md) | What it doesn't do, and what would change | 10 min |
Reference and history:
| Document | What it is |
|---|---|
| [`DECISIONS.md`](DECISIONS.md) | The full append-only log, 88 entries. Everything above is distilled from it |
| [`evals/README.md`](evals/README.md) | The eval explained in plain terms, and why there are two scores |
| [`docs/field-note-template.md`](docs/field-note-template.md) | What a note contains and what the AI fills in |
| [`docs/solution-design.md`](docs/solution-design.md) | The original 50-person design. Closed, kept as history |
| [`docs/phase1-stories.md`](docs/phase1-stories.md) | The story backlog as built. Generated, kept as history |
| [`docs/migration-log.md`](docs/migration-log.md) | Build log per session. Useful as a checklist for a second instance |
| [`CLAUDE.md`](CLAUDE.md) | The instructions the coding agent worked under, including the invariants |
## Licence
MIT. See [`LICENSE`](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessOutdated data