MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / format_learnings_markdown

Function format_learnings_markdown

atomic-agent/src/learnings.rs:160–185  ·  view source on GitHub ↗

Format learnings as individual list items grouped by category. Only includes **Repo** and **Workflow** learnings. Code learnings (with file:line references) are stored in the change's unhashed section, not in the context file — they're noisy, they drift with edits, and in a large project they'd grow unbounded. Returns a map of heading → list items so callers can merge into existing headings inst

(learnings: &Learnings)

Source from the content-addressed store, hash-verified

158/// - cargo test --lib is faster for auth changes
159/// ```
160pub fn format_learnings_markdown(learnings: &Learnings) -> String {
161 let mut out = String::new();
162
163 if !learnings.repo.is_empty() {
164 out.push_str("### Repo\n");
165 for item in &learnings.repo {
166 out.push_str(&format!("- {}\n", item));
167 }
168 out.push('\n');
169 }
170
171 // Code learnings are intentionally NOT written to the context file.
172 // They live in the change's unhashed section where the server can
173 // render them with CRDT graph anchoring. The context file only gets
174 // the durable, location-independent knowledge.
175
176 if !learnings.workflow.is_empty() {
177 out.push_str("### Workflow\n");
178 for item in &learnings.workflow {
179 out.push_str(&format!("- {}\n", item));
180 }
181 out.push('\n');
182 }
183
184 out
185}
186
187/// Count how many learnings would be written to the context file.
188///

Callers 5

test_format_emptyFunction · 0.85
test_format_repo_onlyFunction · 0.85

Calls 2

is_emptyMethod · 0.45
pushMethod · 0.45

Tested by 4

test_format_emptyFunction · 0.68
test_format_repo_onlyFunction · 0.68