Skip to content

Commit 2ef4bc3

Browse files
committed
Add navigability signposts for agents
Minimal ARCHITECTURE.md maps BIP 77/78 spec sections to code locations and documents non-obvious structural decisions (pub(crate) core re-export, common/ wrapping, mailroom routing split). Module docs on persist.rs and ohttp.rs orient agents hitting these files for the first time. Gitignore hides generated/tooling dirs that waste exploration rounds. Informed by arxiv.org/abs/2602.11988 which found verbose context files hurt agent performance — these signposts are kept minimal and focused on things LSP cannot surface.
1 parent 9bee4c7 commit 2ef4bc3

File tree

5 files changed

+42
-1
lines changed

5 files changed

+42
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ mutants.out*
88
*.ikm
99
*payjoin.sqlite
1010
data
11+
.claude/
12+
.direnv/
13+
__pycache__/

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ unstable options.
99

1010
Tools are provided by nix via direnv. Do not install tools globally.
1111
If you need a new tool, add it to the devshell in `flake.nix` so
12-
others can reproduce.
12+
others can reproduce. rust-analyzer LSP is available for navigation
13+
(go-to-definition, find-references, hover) — prefer it over grepping.
1314

1415
## Commit Rules
1516

ARCHITECTURE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Architecture
2+
3+
Implements [BIP 77](https://github.com/bitcoin/bips/blob/master/bip-0077.md) (v2)
4+
and [BIP 78](https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki) (v1).
5+
6+
## Spec-code mapping
7+
8+
| Spec section | Code location |
9+
|---|---|
10+
| BIP 77 sender flow | `payjoin/src/core/send/v2/mod.rs` |
11+
| BIP 77 receiver flow | `payjoin/src/core/receive/v2/mod.rs` |
12+
| BIP 77 directory | `payjoin-directory/src/lib.rs` `handle_decapsulated_request()` |
13+
| BIP 78 sender checklist | `payjoin/src/core/send/mod.rs` `PsbtContext::process_proposal()` |
14+
| BIP 78 receiver checks | `payjoin/src/core/receive/mod.rs` `OriginalPayload` methods |
15+
| OHTTP (RFC 9458) | `payjoin/src/core/ohttp.rs` |
16+
17+
## Non-obvious things
18+
19+
- `payjoin/src/lib.rs` re-exports all of `src/core/` — the `core`
20+
module is the entire implementation but is `pub(crate)`.
21+
- `receive::v2` types wrap `receive::common` via `.inner`; all PSBT
22+
logic lives in `common/`.
23+
- Relay vs directory routing lives in `payjoin-mailroom`, not in
24+
either sub-crate.
25+
- V1 proposals through V2 directories MUST disable output substitution
26+
(enforced in `receive::v2::unchecked_from_payload()`).

payjoin/src/core/ohttp.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! OHTTP encapsulation (RFC 9458) for v2 communication.
2+
//!
3+
//! The relay (ohttp-relay) sees client IPs but not content; the gateway
4+
//! (inside payjoin-directory) sees content but not IPs.
5+
16
use std::ops::{Deref, DerefMut};
27
use std::{error, fmt};
38

payjoin/src/core/persist.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//! Session persistence for the typestate protocol.
2+
//!
3+
//! Protocol methods that advance state return a transition type from
4+
//! this module. Call `.save(&persister)` to persist the session event
5+
//! and extract the next state.
6+
17
use std::fmt;
28

39
/// Representation of the actions that the persister should take, if any.

0 commit comments

Comments
 (0)