# Bower
Bower manages hypothesis-driven stakeholder studies: firm context, a commissioning brief, stakeholder profiles, synthetic personas, issue trees, customized EDSL surveys, registered human or simulated responses, and evidence assessments.
**[Read the worked tutorial](docs/index.html)** for a complete example from commissioning through EP delivery and synthesis, with highlighted CLI commands.
The workflow is **record context → commission → structure → build surveys → execute through EP → register results → assess evidence**. Bower owns study design, versioned personas, and local records. EDSL / `ep` owns model inference, humanize hosting, email delivery, and response retrieval.
Run `bower guide` for the workflow and `bower next` in the project directory for the next step.
## Record firm context and known people first
```bash
bower init ./acme-study --company "Acme Manufacturing"
cd acme-study
bower company set --industry "Industrial manufacturing" \
--business-model "Manufacture to customer orders" \
--attributes '{"sites":["North","South"]}' \
--source "Company overview supplied by Morgan"
bower company add-info footprint --kind fact \
--text "North and South share central finance; North runs day and overnight shifts" \
--source "Company overview and organization chart"
bower stakeholder add morgan --name "Morgan" --role "COO and study sponsor" \
--source "Study request"
bower stakeholder add alex --name "Alex" --role "Plant manager" \
--department "Operations" --email "alex@example.com" --tenure "3 years" \
--incentives "On-time delivery and overtime budget" \
--sensitivities "Team has raised concerns about blame" \
--attributes '{"site":"North"}' --source "Role description"
bower stakeholder add-info alex responsibilities --kind fact \
--text "Owns the shift schedule and reviews the overnight backlog each morning" \
--source "Role description and introductory email"
bower stakeholder add-info alex change-preference --kind assumption \
--text "Likely prefers changes that clarify ownership without adding approvals" \
--source "Analyst working assumption"
bower context show --output study-context.md
bower context show --stakeholder alex --format json
```
Company details include `--description`, `--industry`, `--business-model`, `--headquarters`, `--size`, `--website`, and arbitrary JSON `--attributes`. Each supplied field retains its source. `company set` updates supplied details and merges attribute keys. `company show` displays the profile and its sourced information.
Both `company add-info ID` and `stakeholder add-info PERSON ID` accept `--text` or a UTF-8 `--file`, a required `--source`, and `--kind fact|assumption`. File text is stored locally. Use the corresponding `update-info` command to correct an entry; `history companies company` and `history stakeholders PERSON` retain earlier versions. Background informs preparation; it does not automatically become evidence supporting a hypothesis.
For a larger roster, use `bower stakeholder import --file people.json --source "Organization chart"`. The input is a nonempty JSON array, each row with `id`, `name`, and `role`, plus optional stakeholder profile fields. See [the example roster](examples/people.json). Duplicate IDs, existing people, unknown fields, and malformed rows reject the entire import. Use `stakeholder update` for later changes. People can be recorded before a brief or any hypotheses exist.
## Start the commissioning conversation
```bash
bower agent-start
bower brief run --stakeholder morgan
```
The commissioner can be selected from the roster with `--stakeholder`; alternatively supply `--name` and `--role`. The brief snapshots that person's profile and the available firm context when it starts.
The commissioning conversation establishes the decision, success criteria, scope, sponsor beliefs and alternatives, relevant stakeholders, data access, confidentiality, and deliverables. Enter actual answers one at a time; `/pause` saves progress. Resume with `brief run`.
A calling agent can instead use `brief start --stakeholder morgan`, `brief next`, `brief answer TOPIC --text ...`, and `brief finish`. All eight topics require an answer; record unknowns explicitly and resolve consequential gaps with the commissioner. Completion records the conversation, not formal sponsor sign-off.
```bash
bower brief show --output commissioning-brief.md
bower agent-start
```
The brief must be complete before stakeholder interviews can be planned. To revise it, use `brief reopen --reason ...`, correct answers with `brief answer TOPIC --text ... --replace`, and `brief finish`. Existing guides retain the mandate used to create them.
## Structure the diagnosis
```bash
bower issue add operations --title "Operational causes of late deliveries"
bower issue add handoffs --parent operations --title "Shift handoffs"
bower hypothesis add ownership --issue handoffs \
--statement "Ownership gaps at shift changes delay orders" \
--topic "shift handoffs" \
--test-question "Walk me through how orders move across a shift change." \
--disconfirming-evidence "Order timestamps locate delays upstream of the handoff"
```
Use the target's actual email for live delivery. Stakeholders also accept `--notes`. `stakeholder update ID` changes supplied fields and merges supplied attribute keys. Record known context and label assumptions explicitly.
## Build and register a customized EDSL survey
```bash
bower interview plan alex-01 --stakeholder alex --hypothesis ownership \
--purpose "Understand delays and identify records to check" --minutes 30
bower interview question alex-01 q3 \
--text "Walk me through the orders that crossed yesterday's overnight shift change."
bower interview guide alex-01 --output alex-guide.md
bower interview build alex-01 --output artifacts/interviews/alex-01
```
The guide includes factual and rapport questions, hypothesis tests, competing explanations, verification, implementation concerns, and the final “Is there anything I haven't asked that I should have?” question. Select one to three hypotheses; optional probes support interviewer preparation. The private guide retains firm and stakeholder context as it stood when planned, including sourced background entries. Review that context and customize the questions before building; later background updates do not rewrite an existing guide. A build freezes the questions and writes the following files to the required `--output` directory (relative to the current working directory, independently of `--project`):
- `artifacts/interviews/alex-01/survey.ep`: native EDSL Survey with a `QuestionFreeText` for each tailored question.
- `agents.ep`: a one-person AgentList containing the target email and binding identifiers.
- `delivery-map.json`: the mapping from the roster email field to email delivery.
- `manifest.json`: the target, question signature, and artifact hashes.
Bower registers the output paths and hashes and retains copies under `.bower/interviews/alex-01/`. Existing output directories are never overwritten.
The survey exports the main question text; optional probes remain in the private guide. Include essential probes in the question text before building. Private stakeholder notes, incentives, sensitivities, and sponsor hypotheses are not copied into the survey or roster.
## Deliver through EP and register returned results
The installed EP CLI uses `ep run` for model inference and `ep humanize` for human survey hosting and delivery. Run the EP commands below with the files written by `--output`, then register the resulting file explicitly.
```bash
ep humanize create \
--survey artifacts/interviews/alex-01/survey.ep \
--agent_list artifacts/interviews/alex-01/agents.ep \
--delivery_map artifacts/interviews/alex-01/delivery-map.json \
--name "Acme operations interview" \
--survey_visibility private --agent_list_visibility private
# Replace HUMAN_SURVEY_UUID with the UUID returned by EP.
bower interview register alex-01 --human-survey HUMAN_SURVEY_UUID
ep humanize deliveries create HUMAN_SURVEY_UUID \
--name "Invite Alex" --respondent-email-template respondent_invitation
# After the stakeholder responds:
ep humanize responses HUMAN_SURVEY_UUID \
--output artifacts/interviews/alex-01/results.ep
bower interview register-results alex-01 \
--results artifacts/interviews/alex-01/results.ep
bower interview show alex-01
bower interview finish alex-01 --summary "Ownership gaps may leave orders waiting across shifts"
```
Each delivery command sends an invitation. Registering the UUID in Bower records the external association; it does not publish or send anything. The importer requires native EDSL Results with exactly one response, the registered question names/text/types, the target email and roster binding, and nonempty text answers for every question. It rejects missing, extra, multiple, or mismatched responses before changing interview state. An explicit respondent statement declining a question can be recorded as text; null or blank answers are not treated as completed responses.
Successful registration retains the original package as `.bower/interviews/ID/results.ep` and records its hash, source path, human survey UUID, response ID, and question-level answers. It does not overwrite an earlier registered response. Local package loading pins a commit and does not sync with Coop. These checks establish consistency with the registered artifacts, not independent authentication of a respondent's identity.
The interview progresses through `planned → built → published → received → completed`. The final transition records the analyst's debrief. Append observations or corrections with `interview note ID --text ...`; design a new interview for further fieldwork. The former stakeholder `interview start`, `next`, `answer`, and `run` CLI commands have been removed; the commissioner brief can still be captured conversationally.
## Simulate the same survey with a stakeholder persona
Reuse the sourced background recorded during setup. Add further information with `stakeholder add-info` whenever it becomes available. Select known firm entries explicitly with repeated `--company-info ID` options:
```bash
bower persona build alex-v1 --stakeholder alex \
--company-info footprint --output artifacts/personas/alex-v1
bower persona show alex-v1
```
The persona combines the stakeholder's name, role, department, tenure, incentives, sensitivities, notes, attributes, and sourced information. Its instructions tell the model to distinguish facts from assumptions and acknowledge missing information. Only explicitly selected company information enters the persona. Contact email and the study's hypotheses/commissioning brief are not automatically included. The profile is serialized as a native EDSL AgentList at `artifacts/personas/alex-v1/agents.ep`; review it before running inference because the profile is sent to the selected model when EP executes it.
`stakeholder update-info alex responsibilities --text ... --source ...` revises an information item and retains history. Ordinary profile fields can be revised with `stakeholder update`. Build `alex-v2` to incorporate changes: existing persona versions and simulation inputs remain immutable.
Reuse any built interview survey, including one already delivered to a human:
```bash
bower simulation prepare alex-pilot --interview alex-01 --persona alex-v1 \
--model MODEL_NAME --n 3 --output artifacts/simulations/alex-pilot
ep run --survey artifacts/interviews/alex-01/survey.ep \
--agent_list artifacts/simulations/alex-pilot/agents.ep \
--model MODEL_NAME --n 3 \
--output artifacts/simulations/alex-pilot/results.ep
bower simulation register-results alex-pilot \
--results artifacts/simulations/alex-pilot/results.ep
bower simulation show alex-pilot
```
Replace `MODEL_NAME` with your chosen model. `--service` selects a provider; `--local` forwards local execution to EP and can still invoke paid model APIs. Bower writes `agents.ep` and `manifest.json` to the specified output directory and imports the returned results; it does not execute inference. `--n` specifies repeated interviews, with result iterations numbered from zero.
For a study that only needs simulation, `interview build ID --mode simulation --output artifacts/interviews/ID` registers the same question survey without requiring an email or generating a human delivery roster. The default `--mode human` remains available for humanize. A synthetic persona can use a survey built in either mode; simulation never changes its human interview status or answers.
Each simulation writes `agents.ep` and `manifest.json` in its `--output` directory, with retained copies under `.bower/simulations/ID/`. Results must match the exact survey, persona traits/instructions, run binding, model, optional service, and requested iteration count. Registration saves the native package as `results.ep` and stores all answers and model metadata. Use a new simulation ID to run again or compare a revised persona.
Simulated findings have their own evidence kind:
```bash
bower evidence add sim-ownership --hypothesis ownership --kind simulation \
--simulation alex-pilot --iteration 0 --question q3 --stance supports \
--source ".bower/simulations/alex-pilot/results.ep, iteration 0, answer.q3" \
--summary "The modeled profile suggests reviewing overnight ownership"
bower report
```
Coverage shows simulations separately from stakeholder testimony and business data. Reports display a simulation findings section and identify an assessment based on observed sources, simulation, or a mixture. A simulation can help test the guide and explore assumptions; it does not establish what the real person thinks.
## Link evidence and assess hypotheses
```bash
bower evidence add e-claim --hypothesis ownership --kind interview --stance supports \
--interview alex-01 --question q3 \
--source ".bower/interviews/alex-01/results.ep, answer.q3" \
--summary "Orders sometimes wait for the incoming team to accept ownership"
bower evidence add e-log --hypothesis ownership --kind data --stance context \
--source "Order log, September sample" \
--summary "Some orders wait at handoffs; others wait for materials"
bower evidence check e-claim --against e-log --result inconclusive \
--rationale "Multiple causes are present; compare a broader sample"
bower hypothesis assess ownership --status inconclusive \
--evidence e-claim --evidence e-log \
--rationale "The current evidence does not establish which cause drives overall delays"
bower followup add logs --interview alex-01 --owner "Sam" \
--action "Request complete timestamps and interview the night-shift supervisor"
bower coverage
bower report --output synthesis.md
```
Evidence stances are `supports`, `challenges`, or `context`; source kinds are `interview`, `data`, or `document`. Interview evidence cites an answered question and retains its response snapshot. Checks compare against a data/document evidence item for the same hypothesis and record `corroborated`, `contradicted`, or `inconclusive` outcomes. Bower records analyst review; it does not open source files or validate business numbers automatically.
Hypothesis statuses are `open`, `supported`, `rejected`, or `inconclusive`. Assessments require a rationale and cited evidence, except when reopening. Counts are not confidence scores. `hypothesis revise ID --reason ... --statement ...` reopens the hypothesis and preserves its history; coverage identifies guides and evidence tied to an older statement.
Follow-ups are local tasks, including data requests, member checking, and thank-you reminders. Close them with `followup complete ID --outcome ...`.
## Agent interface and storage
Most commands return `{"status":"ok","data":...}` on stdout. Errors return `{"status":"error","error":{"code":...,"message":...}}` on stderr with exit code 2. Help and Markdown views are plain text; `brief show`, `interview guide`, and `report` support `--format json`. Handoff actions contain argument arrays, readable commands, and explicit network/email flags.
Use `--project PATH` before the subcommand outside an engagement. Within it, Bower searches the current directory and parents. Record groups support `list` and `show ID`; the single brief uses `brief show`. `history KIND ID` shows revisions, and `agent-start` recommends state-dependent next steps. It never automatically sends an invitation.
The canonical record is `.bower/bower.sqlite3`; `.bower/interviews/` retains native survey and result packages. Back up `.bower` and the explicit artifact directories when no command is running; registrations verify the original output paths. `bower export records.json` exports the records and history as JSON, including private data and artifact references; copy native packages separately. JSON re-import is not implemented. Output files are never overwritten.
Reports omit stakeholder profile fields, raw answers, notes, and source locations. Review free-text summaries, rationale, and IDs before sharing. Guides and full exports are private working artifacts. Local storage has no encryption or multi-user access controls.
## Development and offline example
Python 3.11+ is required. Native survey building and result registration use the `edsl` extra; local record operations have no runtime dependencies. The demo exercises the EDSL boundary with local result fixtures and never hosts a survey or sends an invitation.
```bash
python3 examples/demo.py --path /tmp/bower-demo
python3 -m bower --project /tmp/bower-demo report
python3 -m pytest -q
ruff check bower tests examples
```