anchor.diff:    | Some (CTable.Namespace ns_info) ->
       Inr ("namespace", CTable.alist_of_ns_info ns_info)
   
  -let run_code_lookup (st: full_repl_state) symbol pos_opt requested_info =
  +let run_code_lookup st symbol pos_opt requested_info =
     match run_symbol_lookup st symbol pos_opt requested_info with
     | Inr alist -> Inr alist
     | Inl _ -> match run_module_lookup st symbol with
               | Inr alist -> Inr alist
               | Inl err_msg -> Inl "No such symbol, module, or namespace."
   
  -let run_lookup' (st: full_repl_state) symbol context pos_opt requested_info =
  +let run_lookup' st symbol context pos_opt requested_info =
     match context with
     | LKSymbolOnly -> run_symbol_lookup st symbol pos_opt requested_info
     | LKModule -> run_module_lookup st symbol
     | LKOption -> run_option_lookup symbol
     | LKCode -> run_code_lookup st symbol pos_opt requested_info
   
  -let run_lookup (st: full_repl_state) symbol context pos_opt requested_info =
  +let run_lookup st symbol context pos_opt requested_info =
     match run_lookup' st symbol context pos_opt requested_info with
     | Inl err_msg ->
       ((QueryNOK, JsonStr err_msg), Inl st)
  
positive.code:         CTable.register_module_path table (loaded mod_key) mod_path ns_query)
      table (List.rev mods) // List.rev to process files in order or *increasing* precedence
  
  let run_initial_push (st: partial_repl_state) query =
    assert (not query.push_peek_only);
  
    let commit_names st name_events =
      { st with prepl_names = commit_name_tracking None st.prepl_names name_events } in
  
    let on_successful_init (env, name_events) deps repl_deps  =
      TcEnv.toggle_id_info (snd env) true;
  
      let st = commit_names st name_events in
      let full_st =
        { repl_line = 1; repl_column = 0; repl_fname = st.prepl_fname;
          repl_curmod = None; repl_env = env; repl_deps = repl_deps;
          repl_stdin = st.prepl_stdin;
          repl_names = add_module_completions st.prepl_fname deps st.prepl_names } in
  
      wrap_repl_state FullReplState <| run_regular_push full_st query in
  
    let on_failed_init (env, name_events) repl_deps =
      let st = { st with prepl_env = env; prepl_deps = repl_deps } in
      handle_deps_failure (PartialReplState (commit_names st name_events)) in
  
    let env = st.prepl_env in
    let env, finish_name_tracking = track_name_changes env in // begin name tracking…
  
    match load_deps env st.prepl_fname st.prepl_deps with
    | Inl (env, deps, repl_deps) ->
      on_successful_init (finish_name_tracking env) deps repl_deps
    | Inr (env, completed_tasks) ->
      on_failed_init (finish_name_tracking env) completed_tasks
  
  let run_push (st: repl_state) query =
    match st with
    | PartialReplState st -> run_initial_push st query
    | FullReplState st -> wrap_repl_state FullReplState <| run_regular_push st query
  
  let run_symbol_lookup (st: full_repl_state) symbol pos_opt requested_info =
    let dsenv, tcenv = st.repl_env in
  
    let info_of_lid_str lid_str =
  
negative.code:   | GenericError message -> run_generic_error st message
    | ProtocolViolation query -> run_protocol_violation st query
    | VfsAdd (fname, contents) -> run_vfs_add st fname contents
    | Push pquery -> run_push st pquery
    | Pop -> run_pop st
    | AutoComplete (search_term, context) -> run_autocomplete st search_term context
    | Lookup (symbol, context, pos_opt, rq_info) -> run_lookup st symbol context pos_opt rq_info
    | Compute (term, rules) -> run_compute st term rules
    | Search term -> run_search st term
  
  let validate_query st (q: query) : query =
    match q.qq with
    | Push { push_kind = SyntaxCheck; push_peek_only = false } ->
      { qid = q.qid; qq = ProtocolViolation "Cannot use 'kind': 'syntax' with 'query': 'push'" }
    | _ -> match st.repl_curmod with
          | None when query_needs_current_module q.qq ->
            { qid = q.qid; qq = GenericError "Current module unset" }
          | _ -> q
  
  let rec go st : int =
    let rec loop st : int =
      let query = validate_query st (read_interactive_query st.repl_stdin) in
      let (status, response), state_opt = run_query st query.qq in
      write_response query.qid status response;
      match state_opt with
  