Skip to content

Wiki#147

Merged
nmaguiar merged 27 commits into
mainfrom
wiki
Apr 22, 2026
Merged

Wiki#147
nmaguiar merged 27 commits into
mainfrom
wiki

Conversation

@nmaguiar

Copy link
Copy Markdown
Contributor

This pull request introduces a major new feature: a persistent, shared Markdown wiki knowledge base for Mini-A, following the LLM Wiki pattern. Agents can now read from and write to a structured wiki (stored on the filesystem or S3), distilling knowledge into pages that persist across sessions and can be shared between agents. The update also adds extensive documentation, new console commands, parameter support, and auto-completion for wiki operations.

Key changes include:

1. Wiki Knowledge Base Feature

  • Adds a comprehensive wiki system via the new MiniAWikiManager class, supporting both filesystem and S3 backends, with operations for listing, reading, searching, linting, and writing Markdown pages. The wiki is bootstrapped with starter pages and includes lint checks for content quality. ([docs/WHATS-NEW.mdR5-R57](https://github.com/OpenAF/mini-a/pull/147/files#diff-94bd24d22aff1843eebb34c25aa01a1b0454a62e6ef2d383f94adbe89a706cc5R5-R57))
  • New agent action wiki allows agents to interact with the wiki for various operations (list, read, search, lint, write). ([docs/WHATS-NEW.mdR5-R57](https://github.com/OpenAF/mini-a/pull/147/files#diff-94bd24d22aff1843eebb34c25aa01a1b0454a62e6ef2d383f94adbe89a706cc5R5-R57))
  • Wiki parameters are now fully supported in agent files and CLI, including options for backend selection, access control, S3 credentials, and more. ([[1]](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436R558-R570), [[2]](https://github.com/OpenAF/mini-a/pull/147/files#diff-1bffb76c81b4bf9bbbbe2af9dbc7b4b96af2c388d15dc78907134b7590caf578L26-R26))

2. Console and CLI Enhancements

  • Adds /wiki console commands (list, read, search, lint) with tab-completion for subcommands and page names. ([[1]](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436R1212-R1259), [[2]](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436L1768-R1833), [[3]](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436R1966-R1999))
  • New /stats wiki command shows per-operation statistics and errors for wiki usage in the current session. ([CHEATSHEET.mdR1375](https://github.com/OpenAF/mini-a/pull/147/files#diff-0532235a9b8a48e10079c1bfdb2fa41684c5f98a4643eee6728d742668b5b94aR1375))
  • Wiki parameters are included in the session options and are seeded from CLI arguments for consistency. ([mini-a-con.jsR3064-R3070](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436R3064-R3070))

3. Documentation and Cheat Sheet Updates

  • Expanded CHEATSHEET.md with detailed sections on the wiki knowledge base, parameter descriptions, example usage, and a decision guide comparing usewiki and usememory. ([[1]](https://github.com/OpenAF/mini-a/pull/147/files#diff-0532235a9b8a48e10079c1bfdb2fa41684c5f98a4643eee6728d742668b5b94aR19-R20), [[2]](https://github.com/OpenAF/mini-a/pull/147/files#diff-0532235a9b8a48e10079c1bfdb2fa41684c5f98a4643eee6728d742668b5b94aR750-R870))
  • Updated quick reference and parameter tables to include all new wiki-related options. ([AGENT-CHEATSHEET.mdL26-R26](https://github.com/OpenAF/mini-a/pull/147/files#diff-1bffb76c81b4bf9bbbbe2af9dbc7b4b96af2c388d15dc78907134b7590caf578L26-R26))
  • Added a "What's New" entry summarizing the wiki feature, usage scenarios, and protected pages. ([docs/WHATS-NEW.mdR5-R57](https://github.com/OpenAF/mini-a/pull/147/files#diff-94bd24d22aff1843eebb34c25aa01a1b0454a62e6ef2d383f94adbe89a706cc5R5-R57))

4. UI/UX and Activity Feedback

  • Improved activity cue rendering for agent actions, including wiki operations, and added elapsed time and "Esc to cancel" hints in the interactive console. ([[1]](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436L3862-R3971), [[2]](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436L3878-R3989))

5. Miscellaneous

  • Ensured that session options are consistently initialized so that console-only commands (like /wiki) always use the correct configuration. ([mini-a-con.jsR3064-R3070](https://github.com/OpenAF/mini-a/pull/147/files#diff-d9d80d03ec444109c5e8c8a1612038fae26c8392f74c8c4ccabbb8118a9a9436R3064-R3070))

These changes significantly enhance Mini-A's capabilities for persistent, collaborative knowledge management and improve both agent and user workflows.

Add a wiki system allowing agents to distill and retrieve knowledge across sessions.\n\n- Implement `wiki` action with list, read, search, lint, and write operations\n- Support filesystem (fs) and S3 backends\n- Add automatic bootstrapping of AGENTS.md and index.md for new wikis\n- Include comprehensive linting for broken links, orphans, and stale pages\n- Add extensive test suite and update documentation/cheatsheets
- Move list method from constructor to MiniAWikiManager.prototype
- Delegate fs listing to __miniAWikiFsList helper, removing inline logic
- Replace isObject with isMap for config type checks
- Simplify listFilesRecursive result handling
- Filter AGENTS.md from lint page list
- Renumber and clarify lint check comments
Implement /wiki delete command with fs backend support.

Changes:
- Add delete() method to MiniAWikiManager for removing wiki pages
- Conditionally show /wiki in help only when usewiki is enabled
- Add permission guard for read-only wiki access
- Extend activity animation to track memory store interactions
- Add comprehensive tests for delete operation

Fixes completion handling to require usewiki enabled.
Add a guard in the wiki delete operation that prevents AGENTS.md
from being deleted, returning an error instead. Document the
protected-page behavior in WHATS-NEW.md.
Enhance the wiki manager with advanced read, search, and write capabilities:
- read() now supports line ranges, section extraction, maxLines, and countLines
- search() returns line numbers and supports regex, scoped paths, context
  lines, and body-only mode
- write() supports append, line insert, replace line range, and section
  replacement modes
- Add _sliceLines helper for unified line slicing by range or section
- Extend animation interaction detection to cover rate, mcp, and action
  completion events
- Add comprehensive tests for all new wiki features
Show an italic "Esc to cancel" label alongside the elapsed timer in the animation progress message so users know they can abort the running animation with the Escape key.
@nmaguiar nmaguiar self-assigned this Apr 19, 2026
@nmaguiar nmaguiar added bug Something isn't working enhancement New feature or request labels Apr 19, 2026
nmaguiar and others added 18 commits April 19, 2026 17:23
… sections

Remove shellViaActionPreferred conditional notes across all MCP access
modes, delete the STATE MANAGEMENT and WHEN TO USE ACTION ARRAYS
sections, strip unnecessary code fences from examples, and condense
the tool-listing instruction to a single bullet. Adjust rule numbering
offset accordingly.
- Add toolfallback option to auto-recover from malformed tool-call JSON
- Add compressgoal options for automatic goal text compression
- Add memory configuration improvements (memoryuser session support)
- Add wiki FS backend security: reject path traversal, absolute paths, and non-markdown files
- Add tests for wiki security features

Files: 19 files changed, +1022 insertions, -83 deletions
Add comprehensive new settings to mini-a-web.yaml including:
- Debugging and verbose logging controls
- History retention and SSE timeout settings
- Rate limiting (RPM/TPM) and execution thresholds
- Enhanced planning controls and file management
- Wiki integration and memory management parameters
- Agent delegation and worker registration configuration
Extract OAF_MINI_A_LIBS and OAF_MINI_A_MODE env var handling into reusable MiniA functions. Add shouldWarnUnknownArgs to suppress warnings for non-console launches. Add tests for new functions.
Add _prepareLlmForToolRegistration to create bare and working LLM instances
when registering tools, ensuring conversation state is preserved. Normalize
and extend shell/action aliases, handle function-calling style shell
commands, and provide a fallback for missing 'thought' fields.
Add CLI options to the mini-a console for advisor/model orchestration, evidence gating, memory tuning, web UI, and misc feature flags.

These options enable finer-grained runtime configuration for advisor consultations, memory policies, and web/console features.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wrap MiniA.warnUnknownArgs calls with MiniA.shouldWarnUnknownArgs\nchecks to avoid emitting warnings when the feature is disabled. This\nreduces spurious log output.
Add tool-calling failure recovery with graceful fallback to action-based mode.
Introduce payload recovery from nested provider envelopes and conversation history.
Enhance wiki bootstrap tracking to properly categorize bootstrapped files as
created vs skipped.
Add `usetoolslc` to register MCP tools only on the low-cost model while
keeping the main model in prompt/action mode. Introduce `promptprofile`
and `systempromptbudget` for system prompt verbosity and size control.
Add `mcpproxythreshold` for proxy auto-spill size limits. Improve
thinking block extraction by normalizing and stripping wrapper tags.
Track working memory session IDs to prevent cross-session state reuse.
Update tests and documentation to cover all new capabilities.
…nForModelSwitch

Consolidate _setActiveToolMode invocations inside _syncConversationForModelSwitch to ensure the active tool mode is updated consistently whenever the conversation model changes. Removes the now-redundant call from _startInternal.
Update test facts to use clearer descriptions. Add memoryScope option in promotion test. Re-init working memory to trigger channel read metrics. Refactor temp home setup to use io.rm/io.mkdir.
Clarify that MCP tools must be invoked via direct function calling

rather than emitting JSON action wrappers or shell commands.

- Update response format instructions for conditional MCP tool usage

- Remove intermediate JSON think steps before function call examples

- Add wrong-example for narrating tool calls via shell

- Fix mcp-wiki.yaml label requirement and string quoting
Force usejsontool=true when mcpproxy and usetools are both enabled.
Add informational logging for JSON compatibility tool activation.
Add rules preventing unnecessary json tool calls when not available.
Improve error recovery by checking responseWithStats envelope.
The label parameter in mcp-wiki.yaml defaulted to an empty string,

which could cause identification issues. Set the default to "wiki"

for clarity.
…ith-templating-support

Add wiki MCP and expand useutils wiki operations
@nmaguiar nmaguiar marked this pull request as ready for review April 22, 2026 03:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a persistent, shared Markdown “wiki” knowledge base to Mini-A (filesystem or S3 backed), expands interactive console and MCP tooling to support wiki and new runtime flags, and introduces a standalone TUI for managing persisted working-memory stores.

Changes:

  • Introduces wiki knowledge base support (agent action + console /wiki + MCP server) with linting/search/read/write semantics and extensive documentation.
  • Adds a working-memory manager TUI (memoryman=true) plus new memory defaults (memoryusersession) and related CLI/env-default plumbing.
  • Extends CLI/runtime parameters and help/docs (e.g., usetoolslc, goal compression flags) and adds/updates automated tests.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/wiki.yaml Adds wiki test job pipeline wiring.
tests/wiki.js Adds a comprehensive wiki test suite (frontmatter, links, backends, linting, read/write/search/delete).
tests/coreFunctionality.js Adds tests for tool-calling fallback behaviors, memory defaults, env defaults, and capability flags.
tests/autoTestAll.allJobs.yaml Includes wiki tests in the full test run.
mini-a.yaml Adds new CLI parameters/help + seeds runtime args; includes usetoolslc and goal-compression options.
mini-a-web.yaml Expands web-mode parameter help and validation, adds alias handling, and gates unknown-arg warnings.
mini-a-utils.js Adds a wiki utility tool method + tool metadata; hardens _askChooseMultiple return type.
mini-a-modes.yaml Updates a preset to use memoryusersession instead of memoryuser.
mini-a-modelman.js Hardens interactive selection handling via normalized choice indices.
mini-a-memoryman.js Adds a standalone interactive TUI for inspecting and maintaining global/session working memory stores.
mini-a-memory.js Adds channel namespace parsing/listing/deletion helpers for persisted memory stores.
mini-a-mcptest.js Hardens MCP tester interactive selection handling via normalized choice indices.
mini-a-con.js Adds /wiki command + completions, wiki stats mode, memoryman launch mode, env-default handling, and session option seeding from CLI args.
mini-a-common.js Adds shared helpers for normalizing choice indices and applying memory “user default” configs.
mcps/mcp-wiki.yaml Adds an MCP wiki server wrapper exposing wiki operations over stdio or HTTP.
mcps/mcp-mini-a.yaml Adds goal-compression parameters and ensures numeric coercions include the new thresholds.
docs/WHATS-NEW.md Documents the wiki feature and adds memoryusersession to the parameter table.
USAGE.md Documents the new memory manager mode and additional CLI flags.
README.md Adds memory manager usage and updates parameter tables.
CHEATSHEET.md Adds wiki and “choosing knowledge features” sections plus expanded parameter references.
AGENT-CHEATSHEET.md Updates agent-file capability docs to include usetoolslc and wiki/memory-related args.
Comments suppressed due to low confidence (4)

mini-a-mcptest.js:802

  • Same cancel-index issue in the "Show tool details" path: Cancel yields -1, and if (toolIdx < tools.length) will still pass, so showToolDetails(...) can receive undefined. Guard with toolIdx >= 0 before dereferencing toolNames[toolIdx].
                        tools = tools.tools
                        var toolNames = tools.map(t => t.name).sort().concat(["🔙 Cancel"])
                        var toolIdx = normalizeChoiceIndex(askChoose("Choose a tool to inspect: ", toolNames, sessionOptions.toolchoosesize), tools.length)

                        if (toolIdx < tools.length) {
                            showToolDetails(tools.filter(t => t.name == toolNames[toolIdx])[0])
                        }

mini-a-mcptest.js:861

  • The "Set option" picker has the same Cancel handling bug: normalizeChoiceIndex(..., allOptionKeys.length) returns -1 for Cancel, but if (setOptionIdx < allOptionKeys.length) will still pass and then allOptionChoices[setOptionIdx] is undefined. Add a setOptionIdx >= 0 check before using the selection.
                    }).sort().concat(["🔙 Cancel"])

                    var setOptionIdx = normalizeChoiceIndex(askChoose("Choose an option to set: ", allOptionChoices), allOptionKeys.length)

                    if (setOptionIdx < allOptionKeys.length) {
                        var selectedKey = allOptionKeys.filter((k) => allOptionChoices[setOptionIdx].startsWith(k))[0]
                        var def = optionDefinitions[selectedKey]
                        var newValue = ask("Enter new value for " + selectedKey + " (" + def.type + "): ")

mini-a-mcptest.js:779

  • Tool selection has the same cancel-index bug: toolNames includes "🔙 Cancel" but normalizeChoiceIndex(..., tools.length) returns -1 when Cancel is chosen, and if (toolIdx < tools.length) will still pass. This leads to looking up toolNames[-1] and calling showToolDetails / buildToolParams with an undefined tool. Require toolIdx >= 0 before proceeding.
                    } else {
                        tools = tools.tools
                        var toolNames = tools.map(t => t.name).sort().concat(["🔙 Cancel"])
                        var toolIdx = normalizeChoiceIndex(askChoose("Choose a tool to call: ", toolNames, sessionOptions.toolchoosesize), tools.length)

                        if (toolIdx < tools.length) {
                            var tool = tools.filter(t => t.name == toolNames[toolIdx])[0]
                            showToolDetails(tool)

                            var params = buildToolParams(tool)
                            if (isDef(params)) {
                                callMCPTool(_mcpClient, tool, params, sessionOptions)

mini-a-mcptest.js:838

  • The "Toggle option" picker also treats Cancel as -1, but the code only checks optionIdx < optionKeys.length, so it will attempt to run .startsWith on optionChoices[-1] when Cancel is selected. Guard with optionIdx >= 0 (and similarly for the "Set option" picker below).
                    }).sort().concat(["🔙 Cancel"])

                    var optionIdx = normalizeChoiceIndex(askChoose("Choose an option to toggle: ", optionChoices), optionKeys.length)

                    if (optionIdx < optionKeys.length) {
                        toggleOption(optionKeys.filter((k) => optionChoices[optionIdx].startsWith(k))[0])
                        print()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/wiki.yaml
Comment thread mini-a-modelman.js Outdated
Comment thread mini-a-modelman.js Outdated
Comment thread mini-a-mcptest.js Outdated
nmaguiar and others added 3 commits April 22, 2026 04:11
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nmaguiar nmaguiar merged commit 93d508e into main Apr 22, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Continuous Enhancement Apr 22, 2026
@nmaguiar nmaguiar deleted the wiki branch April 22, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

2 participants