MCPcopy Create free account
hub / github.com/Open-Quant/openquant / chapter_prompt

Function chapter_prompt

scripts/afml_docs_loop.py:131–174  ·  view source on GitHub ↗
(
    chapter: str,
    module: str,
    slug: str,
    module_query: str,
    chapter_hit: dict[str, Any],
    module_hit: dict[str, Any],
)

Source from the content-addressed store, hash-verified

129
130
131def chapter_prompt(
132 chapter: str,
133 module: str,
134 slug: str,
135 module_query: str,
136 chapter_hit: dict[str, Any],
137 module_hit: dict[str, Any],
138) -> str:
139 return f"""# Docs Writing Prompt: {chapter} -> {module}
140
141## Scope
142- Chapter: `{chapter}`
143- Module: `{module}` (`/module/{slug}`)
144- Source files:
145 - `docs-site/src/data/moduleDocs.ts` (module content)
146 - `docs-site/src/pages/modules.astro` (subject/chapter entry point)
147 - `docs-site/src/pages/module/[slug].astro` (module page rendering)
148
149## Required AFML grounding
150Use AFML MCP retrieval before writing:
1511. `afml_search(query=\"{chapter_hit.get('section','')}\", chapter=\"{chapter}\", top_k=3)`
1522. `afml_search(query=\"{module_query}\", chapter=\"{chapter}\", top_k=3)`
1533. `afml_get_context(query=\"{module_query}\", chapter=\"{chapter}\", top_k=2, window=1)`
154
155Use chunk ids and page ranges in your internal notes.
156
157## Content contract (must be complete)
1581. High-level purpose and failure modes.
1592. AFML math framing tied to API behavior.
1603. Minimum 2 executable Rust examples (realistic, not toy-only).
1614. Implementation caveats and production constraints.
1625. Cross-links to adjacent modules in same chapter/subject.
163
164## UI/UX contract (not AI slop)
1651. Keep typography intentional and consistent.
1662. Improve scanability with clear section rhythm and spacing.
1673. Avoid generic gradient-heavy cards everywhere.
1684. Keep code blocks readable on mobile and desktop.
1695. Verify rendered page in Astro before marking complete.
170
171## Current AFML anchors
172- Chapter anchor: `{chapter_hit.get('chunk_id','')}` pages {chapter_hit.get('page_start',-1)}-{chapter_hit.get('page_end',-1)} ({chapter_hit.get('section','')})
173- Module anchor: `{module_hit.get('chunk_id','')}` pages {module_hit.get('page_start',-1)}-{module_hit.get('page_end',-1)} ({module_hit.get('section','')})
174"""
175
176
177def build_state() -> dict[str, Any]:

Callers 1

build_stateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected