Skip to content

Commit fba17ed

Browse files
committed
Add navigability signposts for agents
Spec-code mapping and non-obvious structural notes inlined into AGENTS.md where agents auto-load them. 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 fba17ed

4 files changed

Lines changed: 38 additions & 1 deletion

File tree

.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: 24 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

@@ -57,6 +58,28 @@ dependency change:
5758
bash contrib/update-lock-files.sh
5859
```
5960

61+
## Spec-code mapping
62+
63+
| Spec section | Code location |
64+
| ----------------------- | ---------------------------------------------------------------- |
65+
| BIP 77 sender flow | `payjoin/src/core/send/v2/mod.rs` |
66+
| BIP 77 receiver flow | `payjoin/src/core/receive/v2/mod.rs` |
67+
| BIP 77 directory | `payjoin-directory/src/lib.rs` `handle_decapsulated_request()` |
68+
| BIP 78 sender checklist | `payjoin/src/core/send/mod.rs` `PsbtContext::process_proposal()` |
69+
| BIP 78 receiver checks | `payjoin/src/core/receive/mod.rs` `OriginalPayload` methods |
70+
| OHTTP (RFC 9458) | `payjoin/src/core/ohttp.rs` |
71+
72+
## Non-obvious things
73+
74+
- `payjoin/src/lib.rs` re-exports all of `src/core/` — the `core`
75+
module is the entire implementation but is `pub(crate)`.
76+
- `receive::v2` types wrap `receive::common` via `.inner`; all PSBT
77+
logic lives in `common/`.
78+
- Relay vs directory routing lives in `payjoin-mailroom`, not in
79+
either sub-crate.
80+
- V1 proposals through V2 directories MUST disable output substitution
81+
(enforced in `receive::v2::unchecked_from_payload()`).
82+
6083
## AI Disclosure
6184

6285
Add to PR body: `Disclosure: co-authored by <agent-name>`

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)