doc-ask: one command that detects a document's shape, runs the matching sharder (table/transcript/prose), and asks a local Ollama model a question about the resulting opaque shard -- never the raw document. Composes doc-shape + the *-shard family + local-ask's own server-startup/request logic rather than reimplementing any of it (Rule 14).
| Tier | tools |
| Role | unclassified (baselined) |
| Path | crates/tools/doc-ask |
| Edition | 2021 |
| Targets | tools-doc-ask, tools_doc_ask |
| Public items | 6 across 0 modules |
| Tests | 14 |
What it is for
Pure logic for tools-doc-ask: shard dispatch and default-question construction. I/O (reading the file, starting/calling the model) lives at the edge in main.rs.
Capabilities
crate root
Pure logic for tools-doc-ask: shard dispatch and default-question
| Item |
|---|
fn build_shard_json(text : & str, shape : DocShape, task : & str, allowed_outputs : Vec <String>,) -> String |
fn default_question(shape : DocShape) -> String |
fn build_report(shape : DocShape, shard_json : & str) -> String |
fn example_questions(shape : DocShape) -> Vec <& 'static str> |
ContentInspection
Pure logic for tools-doc-ask: shard dispatch and default-question
| Item |
|---|
pub struct ContentInspection |
fn inspect_bytes(bytes : & u8) -> ContentInspection |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct ContentInspection | Content-only anomaly signals -- computed over raw bytes, never reported alongside the actual bytes/content, so this is safe to print even for a file that turns out not to be valid UTF-8 prose at all (the metadata route's whole point: cheap, no-LLM triage before deciding whether a document is even the kind of thing this toolchain can shard). |
fn inspect_bytes(bytes : & u8) -> ContentInspection | Inspect raw bytes for anomalies without assuming they're valid UTF-8 or even text at all -- callers decide what to do with an is_valid_utf8: false result rather than this function guessing. |
fn build_shard_json(text : & str, shape : DocShape, task : & str, allowed_outputs : Vec <String>,) -> String | Build the opaque structural shard for text given its already-detected shape, and return it as pretty JSON |
fn default_question(shape : DocShape) -> String | A shape-tailored default question, used when the operator doesn't supply one: always asks the model to explain the JSON fields first (a cheap, checkable grounding test -- a model that gets the field meanings wrong shouldn't be trusted on the substantive questions either), then a handful of real, shape-specific questions worth asking of that shard. |
fn build_report(shape : DocShape, shard_json : & str) -> String | Build a human-readable, no-LLM summary from an already-built shard's JSON (as produced by build_shard_json) |
fn example_questions(shape : DocShape) -> Vec <& 'static str> | A broader, curated list of example questions per shape, for discovery (tools-doc-ask questions <path>) -- richer than default_question's tight 4-question default, covering every signal each shard family actually emits (including the ones added after the first pass: sentiment, POS proportions, embedding clusters). |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into domain, infrastructure.
Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-book-report, … (84 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | tools |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/tools/doc-ask |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_tools["tools"] --> n_domain["domain"] n_tools["tools"] --> n_infrastructure["infrastructure"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `domain-prose-shard` | domain | no | always |
| `domain-table-shard` | domain | no | always |
| `domain-transcript-shard` | domain | no | always |
| `infrastructure-ai` | infrastructure | no | always |
| `tools-doc-shape` | tools | no | always |
| `tools-local-ask` | tools | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
clap | ^4 | derive | no | always |
serde | ^1 | derive, derive | no | always |
serde_json | ^1 | — | no | always |
tokio | ^1 | full, macros, rt-multi-thread | no | always |
Development, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `tools-cli-conformance` | tools | no | always |
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["tools-doc-ask"] SELF -->|development| n_tools_cli_conformance["tools-cli-conformance"] SELF -->|runtime| n_domain_prose_shard["domain-prose-shard"] SELF -->|runtime| n_domain_table_shard["domain-table-shard"] SELF -->|runtime| n_domain_transcript_shard["domain-transcript-shard"] SELF -->|runtime| n_infrastructure_ai["infrastructure-ai"] SELF -->|runtime| n_tools_doc_shape["tools-doc-shape"] SELF -->|runtime| n_tools_local_ask["tools-local-ask"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| bin | tools-doc-ask | `src/main.rs` |
| lib | tools_doc_ask | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | yes |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 14 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 6 | 0 | 0 |
What the tests establish, by name:
build_report_summarizes_the_real_prose_fixture—src/lib.rsbuild_report_summarizes_the_real_tabular_fixture—src/lib.rsbuild_report_summarizes_the_real_transcript_fixture—src/lib.rsbuild_shard_json_never_leaks_a_real_transcript_speaker_name—src/lib.rsbuild_shard_json_produces_valid_json_for_each_shape—src/lib.rsdefault_question_differs_per_shape_and_always_asks_to_explain_fields_first—src/lib.rsexample_questions_returns_several_real_questions_per_shape—src/lib.rsinspect_bytes_counts_null_bytes_and_control_chars—src/lib.rsinspect_bytes_detects_a_utf8_bom—src/lib.rsinspect_bytes_detects_invalid_utf8—src/lib.rsinspect_bytes_distinguishes_crlf_from_lf_line_endings—src/lib.rsinspect_bytes_reports_valid_utf8_and_zero_anomalies_for_clean_text—src/lib.rsinspect_bytes_tracks_the_longest_line—src/lib.rscli_definition_conforms—src/main.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 6 | 6 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 6
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 704 |
| Code lines | 570 |
| Public API items | 6 |
| Public modules | 0 |
| Tests | 14 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 10 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"function" : 5
"struct" : 1
pie showData
title Rust source composition
"Code" : 570
"Blank or comment" : 134
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.