Rules for developing Classic ASP applications that run on AxonASP (Go-based Classic ASP / VBScript 5.8 runtime, https://github.com/guimaraeslucas/axonasp).
Sources: the AxonASP manual (in the container at /opt/axonasp/www/manual/md, notably authoring/llm-classic-asp-coding.md, asp/*, asp-modernization/*, runtime/*, config/*, libraries/*) plus problems verified while porting this project. Items marked [verified here] were reproduced in this repo's container; the rest come from the manual.
When unsure about an object, ProgID, method or config key, check /opt/axonasp/www/manual/md in the container before guessing. Do not invent APIs.
(repo root) the application (MVC starter, "RouteKit"), also the git repo root
public/ web root (Default.asp front controller + routes, web.config, api/*.openapi.json specs)
core/ framework code (autoload_core.asp, mvc.asp, lib.*.asp incl. lib.JsonLite.asp, helpers.asp)
app/ controllers/ (HTML: <Name>Controller, JSON: Api<Name>Controller), models/ (POBO_<T>, <T>Repository),
views/<Name>/
db/ app.sqlite (SQLite, git-ignored) and migrations/
scripts/ migrate.cmd/.asp, gen.cmd (generators: migration, repo, controller, api), templates/ (POBO,
Repository, Api). Run through the AxonASP CLI in the container.
docker-compose.yml the AxonASP container (stock image ghcr.io/guimaraeslucas/axonasp)
api-tests/ created by `gen.cmd api`: <table>.http sample requests (VS Code REST Client)
docker compose up -d from the repo root -> http://localhost:8801/opt/axonasp/site and sets SERVER_WEB_ROOT=/opt/axonasp/site/public. This keeps ../core, ../app, ../db reachable from public/, and is the layout gen.cmd / migrate.cmd expect (container name must be axonasp).scripts\migrate.cmd status|up|down (runs axonasp-cli inside the container).docker exec axonasp ls /opt/axonasp/www/manual/md (libraries/, asp/, runtime/, ...). There is no deploy/ folder in this repo.scripts\provision.cmd (tenant, principal -> API key printed once, namespace, grant, revoke, list, purge). API calls use Authorization: Bearer <key>; the tenant comes from the key.ApiMemoriesController, ApiSessionsController, ApiHealthController are hand-written (the generators cover one-table CRUD only); routes under /api/v1/... are in public/Default.asp.bash tests/phase1-api.sh (needs the container running; creates and purges its own tenants; ends with a container restart).ApiDocumentsController (ingestion/jobs, jobs, documents, chunks, search) plus POST /recall and POST /memories/:id/verifications in ApiMemoriesController; chunker and FTS5 indexing live in core/lib.Search.asp. Regression suite: bash tests/phase2-api.sh. OpenAPI: public/api/memory-v1.openapi.json. A caller without the needed namespace permission gets 404, never 403.ApiContextController (POST /context) assembles a budgeted briefing. Constraints are loaded by scope (not similarity) and are required: if they do not fit max_context_tokens the answer is 422 context_budget_exceeded. Regression suite: bash tests/phase3-context.sh.core/lib.Embeddings.asp (Ollama client, Qdrant client, embedding_index bookkeeping, Ranker_Class used by recall/search/context; it also applies usefulness feedback on the current revision, see ApplyFeedback). Write paths call Emb_MarkPending/Emb_MarkDelete* inside their transaction and Emb_AfterWrite after commit; new write paths that change memory or chunk text must do the same. scripts\embed.cmd status|run|reindex. Regression suite: bash tests/phase3-semantic.sh. The embed-worker container runs scripts/embed.asp (EMBED_ACTION=worker) every 30 seconds to retry pending/failed items.ApiLearningController (session events, POST /learn, candidates, review, GET /memories/:id/sources, POST /feedback) with helpers in core/lib.Learning.asp: Evidence_Class (validate, resolve and pin evidence), Mem_Create/Mem_Revise/Mem_Verify (memory writes shared with review; inside a transaction), Mem_ForgetLinked (called by forget), and Tel_* (retrieval telemetry: recall/search/context must record the query_id they return and the revision of each result, or feedback cannot reference them). Review needs verify and is refused to the author without admin. New tenant-scoped tables must also be deleted by provision purge. Regression suite: bash tests/phase3-learning.sh.core/lib.Jobs.asp (Job_Create, Job_Claim, Job_RunIngest, Job_ProcessDue), shared by ApiDocumentsController.Ingest and the worker (scripts/embed.asp, actions jobs and worker). Claim jobs only with Job_Claim (conditional UPDATE) and keep publishing plus the job update in one transaction. Regression suite: bash tests/phase3-jobs.sh (uses tests/fixtures/job_state.asp to simulate interruptions).ApiAdminController (/me, /namespaces, /principals, /principals/:id/keys, /keys/:id, /grants). Authorization is path-based through Api_PathAllows: creating below a namespace or granting with inherit needs an inheriting admin grant (checked with the probe path <path>/*), and CanManage (keys, status) needs admin over every grant of the target, so new endpoints that hand out credentials or access must keep that rule (ADR-011). Do not add Idempotency-Key support to endpoints that return a key: the stored replay would contain the plain key. Regression suite: bash tests/admin-api.sh.format html in ApiDocumentsController.Ingest converts with Html_ToMarkdown (core/lib.HtmlAdapter.asp, included after lib.Consolidation.asp) before the job payload is stored, so jobs and documents only ever hold Markdown (documents.format allows text/markdown only); the payload's source_format reaches the response through Job_SourceFormat. Treat pages as untrusted: never fetch what they reference. Regression suite: bash tests/phase4-html.sh.POST /consolidations in ApiLearningController, grouping in core/lib.Consolidation.asp (Consolidator_Class, included after lib.Jobs.asp). Deterministic by design (AC-16): drafts only rearrange the experiences’ own text, and proposals go through normal review. An experience cited by any candidate (any state) is not proposed again until min_size new ones accumulate. Regression suite: bash tests/phase3-consolidation.sh.ApiPortabilityController (POST /exports, POST /imports). The export format (agent-memory-export, schema_version 1) is a contract: a new canonical table or column means a new schema version (and an importer for the old one), and the import must keep ids, revisions, timestamps and principal ids, rebuild derived data (content hashes, FTS, Emb_MarkPending) and stay all-or-nothing. Author ids unknown to the target get placeholder principals (Api_EnsureReferencedPrincipals, status imported, never authenticates) inside the import transaction. Regression suite: bash tests/phase3-portability.sh.scripts\backup.cmd backup|verify|repair and scripts\restore.cmd <file> (scripts/backup.asp; see README “Operations”). Backups go to db/backups/ (git-ignored). bash tests/backup-restore.sh restores into an isolated container on port 8802 and never touches the live database. Never run restore.cmd against the live database without the user's go-ahead.core/lib.Observability.asp (included before lib.Api.asp). Api_Send calls Obs_Record once per response (access-log line via console.log, counters in Application); MVC_InvokeAction sets Obs_Action, so metric labels are controller actions, never raw paths. A response written without Api_Send must call Obs_Record status itself (as ApiHealthController.Metrics does). Never log bodies, query strings or keys. GET /api/v1/metrics needs AMK_METRICS_TOKEN (.env, git-ignored). Regression suite: bash tests/observability.sh.bash tests/retrieval-benchmark.sh (corpus, labelled queries and thresholds in tests/benchmark/fixtures.json, driver tests/benchmark/run_benchmark.py). Rerun it after any change to ranking, the embedding model, EmbeddingMinScore or the FTS query; never lower a threshold to make it pass (record a decision in docs/decisions.md instead). docs/acceptance.md is the acceptance report: update its evidence table and criteria mapping when suites or checks change.docker-compose.yml. To upgrade, change the digest deliberately, docker compose up -d, and rerun all thirteen suites (tests/*.sh).This repo's knowledge base lives on the production server (a separate VM running this app; its URL is AMK_URL in .amk.env), tenant for this repo, namespace /projects/agent-memory. Store memories, lessons and documents there. The local container (localhost:8801) is for development and the test suites only; do not keep knowledge in it. Settings and keys are in .amk.env (git-ignored, local only; never print or commit the keys). Deployment details are a document in the knowledge base (kb.sh search "deployment VM"). Use bash scripts/kb.sh from Git Bash:
kb.sh context "<task>" (verified lessons/decisions plus passages from the ingested docs), or kb.sh search "<question>" for a quick lookup before reading whole files.kb.sh learn lesson|decision|constraint "<title>" "<content>". It stays a proposal until the owner reviews it (kb.sh candidates, kb.sh review <id> accept|reject); the agent key cannot approve its own proposals, and agents must not use AMK_OWNER_KEY.kb.sh ingest <file> (re-ingesting replaces the previous revision).provision purge on it deletes everything.bash scripts/ops.sh migrate|provision|embed|backup|verify|restore (the .cmd scripts are Windows-only). Changes reach it by pushing a branch the server then pulls; the server's operator runs the commands there.scripts\gen.cmd migration create_<table>_table, then fill in Migration_Up/Migration_Down by hand (the generator leaves TODOs), then scripts\migrate.cmd up.scripts\gen.cmd api /table:<Table> /pk:Id. One run writes the POBO + repository, Api<Table>Controller.asp, the includes, the controller whitelist entry, six routes under /api/<table>, public/api/<table>.openapi.json (shows up in the /api/docs dropdown) and api-tests/<table>.http. Validation comes from column types and NOT NULL/DEFAULT, CreatedAt/UpdatedAt text/date columns are set by the server, and an existing controller is never overwritten. Business rules (ranges, formats) are added by hand.scripts\gen.cmd controller <Name> Index "Show(id)" NewForm Create "Edit(id)" "Update(id)" "Delete(id)" writes a stub controller and wires it (include, whitelist, routes: Index/NewForm/Create/Show/Edit/Update/Delete get REST routes, any other action gets GET /<name>/<action>/:param). The actions and app/views/<Name>/{index,show,form}.asp are filled in by hand. Pattern used by the (removed) sample CRUD: list with ?q= search and ?page= paging via the repository's SearchTablePaged; forms carry HTMLSecurity().GetAntiCSRFToken(name) as a hidden csrf_token and POST actions check IsValidAntiCSRFToken (failure: flash error + redirect); validation errors re-render the form with status 422; deletes are POSTs; all output goes through Server.HTMLEncode; the layout header is already buffered, so Response.Clear before Response.Redirect. Put Const values outside the class (section 8).docker restart axonasp, then test (section 10). Add a nav link in app/views/shared/header.asp for new HTML pages.gen.cmd controller from PowerShell or cmd, not Git Bash (quotes such as "Show(id)" reach the script literally; the generator strips them now, but cmd quoting is still the reliable path). Generators run inside the container with the framework folder as web root, so they use paths like /public/..., /app/....Option Explicit in every page and include that owns top-level code.If. Always If ... Then / End If.Dim x = 1. No As Type unless deliberately using an AxonASP extension (section 4).Set for every object assignment. Release long-lived objects with Set obj = Nothing.Call name(args). Foo(a, b) as a statement is wrong. Calling a Function and using its result: parentheses required.And/Or. Both sides are always evaluated, so If Not rs.EOF And rs("x") = 1 and If s = "" Or CDbl(s) > 1 both fail. Nest the Ifs. (AndAlso/OrElse are AxonASP extensions; see section 4.)&, never +.= is both assignment and comparison. String = comparison is case-insensitive. _ at end of line. Statements do not wrap otherwise.On Error Resume Next, check Err.Number, then Err.Clear / On Error GoTo 0. Keep the scope of Resume Next small and check errors right after the risky statement. Never use it to hide failures: report the error (number, description, and the SQL or input involved).<%@Language="VBSCRIPT" CodePage="65001"%> on the very first line, compact, one line. Never leave <% or %> unclosed.ByVal when the caller's variable must not change.Server.HTMLEncode(value). Always URL-encode query values: Server.URLEncode.Application writes must be wrapped in Application.Lock / Application.Unlock. Never Response.Redirect or Response.End while locked.Application/Session.<!--#include ... --> is textual and resolved before execution. The path cannot be a variable.file= is relative to the including file and must not use ..; virtual= is relative to the web root and is the preferred form. This project's framework uses file="../core/..." and it works on this build [verified here], but prefer virtual= for anything under the web root, and keep includes that cross out of public/ consistent.../core/ not ../Core/, lib.Collections.asp not lib.collections.asp). Check this whenever you add or move a file.Sub are allowed here (the MVC dispatcher does it) but inject the file text at that spot.Server.MapPath("/x") is relative to the web root. A relative path is relative to the current script's directory. Under the CLI the web root and script directory can differ from the web server; see section 8.Scripting.FileSystemObject is limited to the web root unless server.allow_external_filesystem_access = true in axonasp.toml. Keep new file access inside the web root (or the mounted framework folder when running the CLI with that as root).global.asa lives at the web root. It is compiled at startup; restart to pick up changes. Request/Response are not available in Application events.AxonASP adds VB6/VB.NET-style features. They make code non-portable to IIS, so use them only when the project has chosen AxonASP permanently, and note it in a comment.
AndAlso, OrElse; IsNot; << / >>.On Error GoTo <label>, GoTo, Resume, On Error GoTo -1 (classic VBScript only has Resume Next and GoTo 0).Optional / ParamArray parameters, Static, Enum, Type ... End Type (UDT), Dim x As Type, Implements, Event / RaiseEvent / WithEvents, non-zero array bounds and Option Base.console.log/info/warn/error for diagnostics.Collection object and [DispId(-4)] for-each delegation.The portable rules in section 2 remain the default for framework and application code.
Create objects with Server.CreateObject("ProgID") using exact ProgIDs from /opt/axonasp/www/manual/md/libraries/overview.md (in the container). Names are case-insensitive. AxonASP maps ProgIDs to native Go implementations; it does not use the Windows registry or COM.
G3JSON, G3DB, G3HTTP, G3CRYPTO, G3MAIL, G3FILES, G3TEMPLATE, G3MD, G3IMAGE, G3PDF, G3ZIP, G3FILEUPLOADER, G3STRINGBUILDER, G3AXON.FUNCTIONS. Exception: do not use G3JSON.Parse in a request that also uses G3DB (see section 8); the API controllers use the pure-VBScript core/lib.JsonLite.asp instead.Val() is not usable in this build (Type mismatch even for “7”). Convert with CDbl (mind the locale decimal separator: JSON uses .).Scripting.FileSystemObject, Scripting.Dictionary, ADODB.Connection/Recordset/Command/Stream, MSXML2.ServerXMLHTTP, MSXML2.DOMDocument / Microsoft.XMLDOM, VBScript.RegExp, WScript.Shell (environment/exec only), CDO aliases for G3MAIL.G3JSON (outside the DB-request caveat above), file upload -> G3FILEUPLOADER, email -> G3MAIL, password hashing and GUIDs -> G3CRYPTO (HashPassword/VerifyPassword use bcrypt, UUID())..wsc, GetObject("script:...")), the WScript host object, cscript/WSH scripts, regsvr32 COM, Access-only SQL.CreateObject and will fail on Linux. Verify a ProgID in the manual before using it.Request.ServerVariables("HTTP_X_ORIGINAL_URL") is an IIS URL Rewrite header and is empty here. Use GetRequestPath() from core/helpers.asp..accdb/.mdb, Jet/ACE) is Windows-only and is not supported in the Linux container.core/lib.Data.asp, DAL()) runs on G3DB. ConnectionString in public/web.config is <driver>:<dsn>, currently sqlite:/opt/axonasp/site/db/app.sqlite. Use DAL().Query(sql, params) (result set), DAL().Exec(sql, params) (returns RowsAffected/LastInsertId), DAL().Execute, PagedQuery(sql, params, per_page, page) (LIMIT/OFFSET), and BeginTransaction/CommitTransaction/RollbackTransaction. params is Empty, one value, or an array (max 8). Failures raise a VBScript error that includes the SQL.EOF, MoveNext, rs("col"), rs(0), Fields.Count, GetRows, Close. They do not expose column names (Fields(i).Name fails), so anything that needs names must select explicit, aliased columns. G3DB does not expand an array into parameters and gives no driver error text for statements inside a transaction.G3DB is the preferred native API for new code: db.Open("sqlite", path), db.Query(sql, params...), db.Exec(sql, params...), db.Begin(). It returns Empty on failure and reports via db.LastError.TOP n (use LIMIT n), no #date# literals (use ISO 'YYYY-MM-DD HH:MM:SS' text), INTEGER PRIMARY KEY AUTOINCREMENT, DROP INDEX name (no ON table). ALTER TABLE ... DROP COLUMN needs SQLite 3.35+.? parameters for user input. [verified here] the old ADODB Command.Execute(, Array(...)) path failed with “missing argument with index 1”; G3DB parameters work.app.sqlite./opt/axonasp/config/axonasp.toml inside the container (stock image; override with env vars in docker-compose.yml). Any key can be overridden by an environment variable when viper_automatic_env = true: [server] web_root -> SERVER_WEB_ROOT, server_port -> SERVER_SERVER_PORT, [global] default_mslcid -> GLOBAL_DEFAULT_MSLCID, and so on. A different config file: axonasp-http -c path.toml.enable_webconfig = true, only from the web root, and only a subset of IIS (rewrite, httpRedirect, httpErrors, and appSettings read by app code). Subdirectory web.config files are ignored.(?!...)), no backreferences. [verified here] a lookahead rule silently never matched. To exclude static files, use the IsFile / IsDirectory conditions instead. Supported condition inputs: {REQUEST_FILENAME}, {URL}, {REQUEST_URI}. Rewrites run before ASP execution. After a rewrite the server's URL is the rewritten target, so pass the original path in the query string (__route), as public/web.config does.GetAppSetting("Key") (reads web.config appSettings). Keep secrets out of source control; prefer environment variables for credentials.Session.LCID (default global.default_mslcid). Set it explicitly before FormatDateTime, FormatNumber, FormatCurrency.db/migrations/ and are named YYYYMMDDHHMMSS_description.asp (14-digit version). Each defines Migration_Up(migration) and Migration_Down(migration).migration: ExecuteSQL, CreateTable, DropTable, AddColumn, DropColumn, CreateIndex, DropIndex.scripts\migrate.cmd status, up, down (one step). The runner is scripts/migrate.asp using Migrator_Class in core/lib.Migrations.asp.On Error Resume Next there.CLng (overflow); use CDbl or compare strings.bytecode_caching_enabled in [global]). During development, if an edit seems ignored or an error line number does not match the file, run docker restart axonasp (or set GLOBAL_BYTECODE_CACHING_ENABLED=disabled) before debugging further.Response.Write markers rather than trusting the line.MVC.DispatchRequest a, b (where MVC is a Function returning an object) failed with “Object required”. Use MVC().DispatchRequest a, b, or assign to a variable first: Set m = MVC(). The same applies to router, Flash, Routes, DAL, and any singleton accessor. Expression form (x = MVC.Prop, TypeName(MVC)) works.put is parsed as the file Put #n statement and breaks put "text". Do not name Subs/Functions after VB statements (Put, Get, Open, Close, Print, Input, Seek, Lock, Name, Kill, ...). The framework's output helper is now puts / puts_.ReDim of a module-level array inside a Sub/Function does not reach the global. The Sub got its own local array, and a later UBound/index on the global failed with “Subscript out of range” or “Stack underflow” (chunker, in this repo). Keep growable arrays as Private members of a Class (Chunker_Class in core/lib.Search.asp) and expose accessor functions. Also keep every If ... Then <call> multi-line.Const is Empty. Private Const X = 10 inside a Class evaluates to Empty in methods (no error, so e.g. per_page silently became 0 and paging broke). Declare Const at top level, outside the class, with a prefixed name.G3JSON.Parse before the first database open in the process made the first INSERT silently do nothing (201 with id 0, no row), and only on the first POST after a restart; opening the database first made Parse return dictionaries whose Exists/Item returned stale values. Dictionaries built in a Function and returned also came back empty, and the first native call after another native call could return the previous value. For API controllers use core/lib.JsonLite.asp (pure VBScript: JsonLite_Parse -> object with .Exists(k)/.Item(k) (call .Item, there is no default member), JsonLite_Quote, JsonLite_Num) and compose output JSON as text. Plain VBScript classes are safe; native objects held across other native calls are not.Request.BinaryRead(n) returns one character per byte (raw UTF-8 bytes), not decoded text. Decode UTF-8 yourself (Utf8Decode in the API controllers, which maps invalid bytes to U+FFFD); ADODB.Stream was unreliable too. MSXML2.ServerXMLHTTP works in the CLI for calling the local server, which is a handy way to write an HTTP smoke test (axonasp-cli -r script.asp inside the container, base URL http://localhost:8801).Err. Under On Error Resume Next, any later DAL() call sets Err.Number back to 0 (plain functions, subs and builtins do not). A transaction that runs several statements and checks Err once before committing therefore lost an early failure and committed a partial write: two concurrent ingests of the same source_uri produced a second document without its source_uri (the unique-index violation was wiped). Database_Class now remembers the first error raised inside an open transaction and CommitTransaction rolls back and raises instead of committing. Still check Err after CommitTransaction, and do not rely on catching a failed statement inside a transaction and carrying on: the commit will refuse.Dispatch/ExecuteControllerAction in core/mvc.asp run under On Error Resume Next, so an error inside an action aborts it and the response is an empty 200 (or a half page) with no message. For write paths wrap the DB call in a local On Error Resume Next, check Err.Number straight after it and answer with a real error (the API controllers send a JSON 500 via DbFailed). When something “does nothing”, test the same code from a plain page or the CLI to see the real error.docker restart axonasp, send the write request (POST/PUT/DELETE) first, before any GET: some bugs only appear on the first request after a start. Debugging aid: Response.Clear wipes the body, but Response.AddHeader "X-Dbg-1", "..." survives, so trace with headers (curl -i). When patching with scripts, assert that each replacement matched (a silent no-op edit cost hours here)."ok=" & Not (x Is Nothing) raises Type mismatch. Put the Not ... in a variable first.Response.Clear before Response.Redirect, and for non-HTML actions set useLayout to False (the API controllers do).public/ (for example public/api/*.openapi.json) are served directly; the rewrite rule skips existing files and directories. Only routes in public/Default.asp go through the MVC dispatcher; a route needs the controller in autoload_controllers.asp and in ControllerRegistry (the generators do both).urls: [...]) only works with presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset] and layout: "StandaloneLayout". Without them the page says “No API definition provided”.curl sends non-ASCII literals as cp1252, not UTF-8 (use \u00fc escapes or a file with --data-binary @file); read CSRF tokens from the form with a cookie jar (-c/-b); strip \r from values printed by Python on Windows before putting them in URLs. Python on Windows also reads piped stdin as cp1252: tests that compare non-ASCII text must call sys.stdin.reconfigure(encoding='utf-8') (python -I ignores PYTHONIOENCODING).Router_Class.Resolve returns ErrorController.MethodNotAllowed (with an Allow header) when the path is routed for other methods; ErrorController answers /api/... requests with the JSON error format and no layout. Routing happens before authentication, so a wrong method is 405 even without a key.Api_ToInt clamps to its range instead of rejecting, so use it for limits and paging only; validate values that must be rejected when out of range (for example ?revision=) explicitly.Api_Now() timestamps) rather than moving them to the follow-up UPDATE.GetRouter(), Flash() failed with “Object required” / “doesn't support this property or method”). core/autoload_core.asp therefore includes mvc.asp last.Eval/Execute inside a Class method cannot see global functions; with a runtime-built string they re-emit a method's inline HTML twice (second copy after the footer); CallByName is a silent no-op. Do not dispatch with them.CurrentController.Invoke ... in one place was bound to the first controller's Invoke and reused for every later controller (the first dispatched action's body appeared on every route; title/layout were right). Each controller therefore exposes a global <Name>Controller_Invoke(actionName, args) and the dispatcher calls it through GetRef (MVC_InvokeAction). New controllers must define Invoke and <Name>Controller_Invoke (the generators emit both).If x Then a = b Else a = c swallowed the rest of a Sub under On Error Resume Next. Always use multi-line If.migrate.cmd up with two or more pending migrations failed on the second one (Runtime error: Migrator '800A0002'; an AxonASP VM panic “assignment to entry in nil map” when reproduced in a plain script). Run migrate.cmd up once per pending migration. Even a successful apply/rollback currently ends with Object required from core/helpers.asp and exit code 1 (reproduced on the original unmodified framework, so not caused by local changes); check migrate.cmd status rather than the exit code.provision key action created no key). Copy the values you need, rs.Close, then query/write.InsertRevision in ApiMemoriesController.asp).ChrW(128512) raises “Invalid procedure call” (older builds returned one character), and ChrW(55357) & ChrW(56832) is written out as CESU-8 (ED A0 BD ...), which is invalid UTF-8. Api_Utf8Decode and JsonLite therefore flag such code points (raw 4-byte UTF-8 or escaped surrogate pairs) and Api_ReadBody answers 422 unsupported_character; the generator template does the same. Do not store them as U+FFFD silently.MSXML2.ServerXMLHTTP to Ollama and Qdrant, reads and writes before and after, cold first request). Set SetTimeouts so a dead service cannot hang the request, never let an HTTP failure fail a database write, and keep large JSON (vectors) as text: slice it with InStr/Split instead of parsing it with JsonLite.EmbeddingTimeoutMs (10 s) and Emb_AfterWrite stops starting batches after EmbeddingWriteBudgetMs (8 s), leaving rows pending without using up attempts. Only the CLI worker waits 60 s. Test slow-provider behaviour with docker pause ollama (connections hang) as well as docker stop ollama (connections refused).nomic-embed-text (and its search_query: /search_document: prefixes) relevant pairs scored 0.61-0.67 and unrelated ones up to 0.58, hence EmbeddingMinScore 0.6. Re-measure before changing the model, and remember the memory title is part of the embedded (and FTS-indexed) text.AscW is signed: characters U+8000..U+FFFF give negative values, so AscW(c) > 127 misses them (fixed in Search_FtsQuery). The same applies to CLng("&H" & hex) for 4-digit hex.content_hash is not a content hash. memory_revisions.content_hash is SHA-256 of namespace|type|title|content (used for duplicate detection in one namespace). To dedupe the same text across namespaces compare the content itself (as ApiContextController does).\uXXXX written in a tool command or file edit was sometimes decoded to the real character before bash/curl ran (curl then sent ??), which looked like a server bug. Produce backslashes at run time in tests (printf '%su00fc' '\', Python chr(92)), check test files for unintended non-ASCII bytes, and confirm what curl sends with --trace-ascii - before blaming the runtime. The same happened to \r, \b and \a inside Bash heredocs (they became CR, backspace and bell bytes in the written file, for example db\backups in Markdown): after scripted edits, check for control bytes with LC_ALL=C grep -c $'[\x01-\x08\x0b-\x1f]' <file>, and in shell code prefer tr -d '[:cntrl:]'-style classes or octal escapes.Len, Mid, InStr and friends take time that grows with the length of the string they get (Len of 200 KB about 0.4 ms, InStr about 5 ms), so a per-character loop over a large string is quadratic and hit the 60 s script timeout (JSON parsing of an import). Process large text in bulk: VBScript.RegExp (Execute over 450 KB took 30 ms), Replace, Split, and G3STRINGBUILDER (Append/ToString) instead of s = s & x in loops. core/lib.JsonLite.asp tokenizes with one RegExp and Api_Utf8Decode works on byte runs for this reason.Match.FirstIndex/Length are byte offsets into the UTF-8 text, not character positions (contrary to the manual), so do not Mid with them on non-ASCII strings; use Execute results’ Value or Replace/Split instead. A literal backslash or bracket inside a character class ([^"\\]) fails in AxonASP's pattern translation: write \x5C, \x5B, \x5D.G3AXON.FUNCTIONS AxUrlDecode also turns + into a space. It is used to decode percent-encoded UTF-8 byte runs that cannot contain +; do not feed it raw text.Private m_cnt(7) in a Class gave “Subscript out of range” when used; declare Private m_cnt() and ReDim m_cnt(7) in a method.console.log lines are decorated. In the HTTP server they go to stdout (docker logs) with ANSI colour codes, a date/time and a marker before the text, and end with the text plus a newline. Write one JSON object per call and extract it with grep -o '{"log":.*'. WScript.Shell ExpandEnvironmentStrings reads the container's environment in the HTTP server too.VACUUM INTO works through G3DB and gives a consistent copy while the server is running (scripts/backup.asp). There is no sqlite3 binary in the image; use the CLI with G3DB for database maintenance. PRAGMA foreign_keys is off, so check PRAGMA foreign_key_check (the backup verification fails on violations).-wal/-shm files left by a host process (uid 1000) made the database read-only for the container user, so every write and even API-key authentication failed. Stop the containers, remove the stray files, restart. Maintenance goes through the CLI tools inside the container. Updating api_keys.last_used_at is best-effort for this reason: a failing write there must not turn a valid key into a 401.HandleDispatchError in core/mvc.asp answers /api/... requests whose action raised with a JSON 500 internal_error (detail only when Environment is Development), rolls back an open transaction and logs {"log":"action_error",...} with console.error. Settings can be overridden per environment with APPSETTING_<key> environment variables (GetAppSetting).core/lib.Html.asp on the Windows host silently overwrote the framework's core/lib.HTML.asp (the HTML view helper), and Docker Desktop's bind mount hid it because it is case-insensitive too; only git status showed it. Before creating a file, check that no file with the same name in another case exists (ls core | grep -i <name>), and give new files distinct names.axonasp; a database file first created by a root docker exec was read-only to it (“attempt to write a readonly database”). gen.cmd, migrate.cmd and provision.cmd use docker exec -u axonasp.read,write into two arguments. Quote lists passed to provision.cmd grant: '"read,write"'.Dim controllerName inside a class that also has a ControllerName property.Empty Is Nothing raises “Object required”. Test with IsObject / IsEmpty first, then Is Nothing.Server.Execute(file) runs the file as a separate page. It does not define procedures in the caller's scope. To load a script's Subs, read the file and ExecuteGlobal the text (strip <%/%>), as the migrator does.axonasp-cli -r file.asp runs ASP; -m vbscript runs pure .vbs (no WScript). The CLI's web root comes from config (SERVER_WEB_ROOT), Server.MapPath is relative to the script's folder, relative .. is clamped to the web root, and FileSystemObject cannot leave the web root. Run CLI tools with -e SERVER_WEB_ROOT=<framework folder> and use Server.MapPath("/...")./opt/... arguments passed to docker exec. Prefix with MSYS_NO_PATHCONV=1, or run from cmd/PowerShell.db/app.sqlite) are owned by root inside the container; this is fine on Windows hosts.Execute/Eval dispatch (the registry in core/lib.ControllerRegistry.asp does this). Never build code or SQL from raw request input.Server.HTMLEncode all output derived from input, headers, DB data and errors.ASPError details (file, line, source) to end users in production. Log them instead; custom pages go through httpErrors in web.config.blocked_extensions / blocked_dirs in the container's axonasp.toml intact. Do not place secrets, .sqlite files or migrations under the web root (public/).allow_external_filesystem_access unless a trusted need is documented.G3CRYPTO for hashing and tokens. Do not roll your own.HTMLSecurity()).scripts\gen.cmd migration; model + repository -> scripts\gen.cmd repo; JSON API (controller, routes, whitelist, includes, OpenAPI spec, .http file) -> scripts\gen.cmd api; HTML controller stub with routes -> scripts\gen.cmd controller; schema changes -> scripts\migrate.cmd up|down|status. Edit generated files afterwards (migration bodies, business rules, views), but never write a controller, repository, POBO, route, whitelist entry or migration file from scratch when a generator exists, and never change the schema outside a migration. If a generator is missing a feature or produces something wrong, fix the generator/template in scripts/ (and say so) instead of patching the output only.gen.cmd and migrate.cmd run docker exec ... axonasp ./axonasp-cli, so Docker must be running and the axonasp container up (docker compose up -d from the repo root) before using them. If it is not running, start it or tell the user; do not fall back to hand-writing the files. Run them from PowerShell or cmd, not Git Bash. Generators only write files: docker restart axonasp afterwards.curl localhost:8801/...) before claiming success. Report real output and real errors.api-tests/<table>.http and the Swagger page /api/docs.migrate.cmd down first), and leave the database as you found it.On Error Resume Next to silence an error. Surface it./opt/axonasp in the container except the mounted site/ folder.db/.Powered by TurnKey Linux.