Inspiration
AI editing is useful, but some parts of a document must not change: approved legal clauses, verified facts, compliance text, quotations, code fragments, or carefully reviewed wording.
Prompts such as “do not change this sentence” are instructions, not guarantees. A model may still paraphrase, omit, reorder, or subtly alter text that has already been approved.
AnchorEdit was built to move that responsibility away from the prompt and into the application.
What it does
AnchorEdit lets a user select one or more trusted regions as anchors, describe how the rest of the document should be improved, and run an AI edit.
The locked text is shared with GPT-5.6 as read-only context, while the model is permitted to return only the unlocked segments. The server then reconstructs the document using the original anchored text and verifies every anchor against both the original string and its SHA-256 hash before accepting the result.
The result screen shows a line diff, marks anchored lines with a lock icon, and reports whether every locked region passed server verification.
How we built it
AnchorEdit is a dependency-free Node.js prototype using the OpenAI Responses API and GPT-5.6.
The browser first sends the original document and anchor ranges to the server. The server creates an ordered plan of locked and unlocked segments, stores it temporarily behind a random lock ID, and assigns a SHA-256 digest to every locked segment.
For the edit request, the browser sends only the lock ID and instruction. Structured Outputs restrict the model response to unlocked segment IDs and edited text. The server validates the response, reconstructs the document from the server-held source, and rejects the entire result if any anchor fails verification.
Codex was used throughout implementation and review: translating the architecture into a working prototype, debugging the client/server flow, improving the three-step Anchor → Edit → Verify experience, and expanding the automated test suite to 37 passing cases.
Challenges we ran into
The main challenge was separating “the model was told not to change it” from “the application proved it did not change.”
That required careful handling of overlapping selections, line-ending normalization, temporary server-side state, malformed model output, retries, expired sessions, and verification failures without losing the user’s original anchors.
Another important challenge was describing the guarantee honestly. AnchorEdit guarantees that anchored strings remain identical after LF normalization. It does not guarantee that editable text placed around an anchor cannot change its meaning.
Accomplishments that we're proud of
- Built a complete Anchor → Edit → Verify workflow
- Integrated GPT-5.6 through the OpenAI Responses API
- Reconstructed every result from the server-held original anchors
- Added SHA-256 verification for locked regions
- Implemented strict Structured Outputs for unlocked segments only
- Preserved anchors across retries without requiring the user to select them again
- Reached 37 passing automated tests with no external runtime dependencies
What we learned
Reliable AI editing benefits from combining flexible model behavior with deterministic application checks.
GPT-5.6 handles the language transformation, while the server owns reconstruction and verification. That separation makes the product boundary explicit, testable, and visible to the user.
What's next for AnchorEdit
Next, I would explore a hosted demo, support for larger documents, clearer semantic-risk warnings around surrounding editable text, and integrations for workflows such as legal review, compliance editing, and verified technical documentation.
Built With
- api
- codex
- css
- gpt-5.6
- html
- javascript
- node.js
- openai
- sha256
Log in or sign up for Devpost to join the conversation.