//! `atgc agent`: working notes for agents, printed by the binary itself. //! //! The notes exist because an agent meeting atgc pattern-matches it to the //! forge CLIs it already knows, and everything Tangled does differently is //! exactly what that reflex gets wrong: pushing does not update a PR, //! bodies can carry images, stacks reconcile by change-id. `--help` states //! flags; it cannot state which habits to unlearn. //! //! The text lives in the binary rather than in a checked-in skill file for //! one reason: a document versioned with the code it describes cannot go //! stale. The version line inside the notes is the contract, and the test //! below holds it. const NOTES: &str = include_str!("agent_notes.txt"); pub(crate) fn agent() { print!("{}", NOTES.replace("{version}", env!("CARGO_PKG_VERSION"))); } #[cfg(test)] mod tests { use super::NOTES; /// The self-description is the anti-staleness contract: the notes must /// name the version that prints them, and nothing else in them may /// need substitution. A second placeholder added to the text without a /// substitution here would print literally. #[test] fn the_version_placeholder_is_the_only_one() { assert_eq!(NOTES.matches('{').count(), 1); assert!(NOTES.contains("atgc {version}")); } /// Terminal-safe means ASCII: the notes are printed raw to whatever /// stdout is, with no markdown renderer and no locale guarantees. #[test] fn the_notes_are_plain_ascii() { assert!(NOTES.is_ascii()); } /// A fresh-context agent read these as `atgc agent | head -80`: token /// rationing is the reader's normal condition, not an edge case. Stay /// under that budget so a truncated read still gets everything. /// /// The budget is spent, so a new subject arrives by displacing an old /// one. That is the point of the number and not a reason to raise it: /// the one time it was treated as a wall rather than a trade, `doctor`, /// `api` and the `issue` family all shipped unmentioned. /// /// "Reporting problems" was paid for that way: the `stack link` and /// `--add-change-ids` example lines, both already stated in the prose /// beside them, and two lines of `stack create` wording that said the /// same thing twice. #[test] fn the_notes_fit_one_impatient_read() { let lines = NOTES.lines().count(); assert!(lines <= 76, "notes are {lines} lines; the budget is 76"); } }